prismatiq
Version, currently 0.5.216 versions
- 0.7.3latestJul 21, 2026
- 0.7.1not indexedJul 21, 2026
- 0.6.2not indexedJul 21, 2026
- 0.6.1not indexedJul 21, 2026
- 0.6.0not indexedJul 21, 2026
- 0.5.6.1not indexedJul 21, 2026
- 0.5.6.0not indexedJul 21, 2026
- 0.5.5.0not indexedJul 21, 2026
- 0.5.4.0not indexedJul 21, 2026
- 0.5.3not indexedJul 21, 2026
- 0.5.3.1not indexedJul 21, 2026
- 0.5.2not indexedJul 21, 2026
- 0.4.1not indexedJul 21, 2026
- 0.4.0not indexedJul 21, 2026
- 0.2.0not indexedJul 21, 2026
- 0.1.0not indexedJul 21, 2026
github.com/kritoke/PrismatIQ
A high-performance Crystal shard for extracting dominant color palettes from images using the YIQ color space. This is a port of the Color Thief logic (MMCQ) but optimized for Crystal's performance and perception-based color math.
Nothing has been indexed for 0.5.2 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
prismatiq:
github: kritoke/PrismatIQ
version: ~> 0.5.2Then run:
shards installshard.yml
No shard.yml has been indexed for 0.5.2. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
PrismatIQ
A high-performance Crystal shard for extracting dominant color palettes from images using the YIQ color space. This is a port of the Color Thief logic (MMCQ) but optimized for Crystal's performance and perception-based color math.
Features
- Color Palette Extraction: Extract dominant colors from any image format
- SVG Support: Extract colors directly from SVG vector graphics (no rasterization needed)
- WCAG Accessibility: Built-in WCAG contrast checking and color adjustment
- Theme Detection: Automatic dark/light theme detection and color pairing
- ICO Support: Extract palettes from Windows icon files (PNG and BMP encoded)
- Caching: Intelligent caching for frequently-used calculations
- Error Handling: Explicit error handling with Result types
- Memory Safe: Configurable image dimension limits to prevent excessive memory use
Quick Examples
Basic Palette Extraction
require "prismatiq"
options = PrismatIQ::Options.new(color_count: 5, quality: 10)
# With explicit error handling (recommended)
result = PrismatIQ.get_palette_v2("image.png", options)
case result
when .ok?
result.value.each { |color| puts color.to_hex }
when .err?
puts "Error: #{result.error.message}"
end
# Or the raising variant
begin
colors = PrismatIQ.get_palette_v2!("image.png", options)
colors.each { |color| puts color.to_hex }
rescue ex : Exception
puts "Failed: #{ex.message}"
end
Single Color Extraction
color = PrismatIQ.get_color("image.png")
if color
puts color.to_hex
end
Theme Extraction
# Extract theme (background + text colors) from file or URL
theme = PrismatIQ.extract_theme("favicon.ico")
if theme
puts "Background: #{theme.bg}"
puts "Light text: #{theme.text["light"]}"
puts "Dark text: #{theme.text["dark"]}"
end
# Clear shared caches when needed
PrismatIQ.clear_caches
SVG Color Extraction
# From SVG string
colors = PrismatIQ::SVGColorExtractor.extract_colors(%(<svg><rect fill="#FF0000"/></svg>))
# From SVG file
result = PrismatIQ::SVGColorExtractor.extract_from_file("icon.svg")
Buffer-based Extraction
palette = PrismatIQ.get_palette_from_buffer(pixels, width, height, options)
Documentation
- API Reference - Complete method reference
- Error Handling - Working with Result types and errors
- WCAG Accessibility - Accessibility calculations and compliance
- Theme Detection - Theme analysis and color pairing
- Configuration - Options and runtime configuration
- Changelog - Version history and migration guides
Version
0.7.3
Security Considerations
SSRF Protection
When using the ThemeExtractor to fetch images from URLs, PrismatIQ includes built-in Server-Side Request Forgery (SSRF) protection:
- Private IP Blocking: Requests to private/reserved IP ranges are blocked by default:
- IPv4:
10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,127.0.0.0/8,169.254.0.0/16,0.0.0.0/8 - IPv6:
::1/128,fc00::/7,fe80::/10
- IPv4:
- URL Scheme Validation: Only
http://andhttps://URLs are allowed - DNS Rebinding Protection: IP addresses are resolved and validated before connection
Configuration
config = PrismatIQ::Config.new(ssrf_protection: false)
Or via environment variables:
export PRISMATIQ_SSRF_PROTECTION=false
export PRISMATIQ_SSRF_ALLOWLIST=internal.company.com,localhost
Path Validation
When extracting from local files, PrismatIQ validates:
- Path Traversal: Blocks
..and URL-encoded variants (%2e%2e,%252e%252e) - Null Byte Injection: Rejects paths containing
\0 - System Directories: Prevents access to system paths on Linux
- File Size Limits: Enforces 100MB maximum file size
Debug Mode
When PRISMATIQ_DEBUG=true is set, all caught exceptions are logged to STDERR. This may include sensitive information (URLs, file paths) - use only during development.
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.5.2- Tagged
- Jul 21, 2026
- Commit
ae6545984b24- Indexed
- not yet
Dependents
No indexed shard depends on this one yet.
Repository
github.com/kritoke/PrismatIQ
Metadata
- Created
- Aug 12, 2026
- Updated
- Sep 26, 2026
- Synced
- Sep 26, 2026
- Versions
- 16