Releases: jramosg/color-tools
Releases · jramosg/color-tools
[1.1.0] - 2025-12-02
Added
- Color Blending Modes: Professional blending operations for design workflows
blend-multiply- Multiply blend mode (darkens)blend-screen- Screen blend mode (lightens)blend-overlay- Overlay blend mode (combines multiply and screen)
- Tints, Shades, and Tones: Essential design system utilities
tint- Mix color with white (lightens while preserving hue)shade- Mix color with black (darkens while preserving hue)tone- Mix color with gray (reduces saturation)tints,shades,tones- Generate series of variations
- Alpha Blending and Compositing: Proper transparency support
alpha-blend- Porter-Duff alpha compositingwith-alpha- Set alpha channel of any color
- Color Interpolation: Smooth color transitions
interpolate- Interpolate between multiple colors in RGB, HSL, or HSV spacegradient- Generate gradients with n steps between colors- Supports hue wrapping for natural color transitions
- Perceptual Color Difference: More accurate color comparison
rgb->lab- Convert to CIE L*A*B* color spacedelta-e- Calculate perceptual difference using CIE76 Delta E formulaperceptually-similar?- Check similarity using JND (Just Noticeable Difference)
- Color Temperature (Kelvin): Physical light color representation
kelvin->rgb,kelvin->hex,kelvin->color- Convert temperature to colorrgb->kelvin- Approximate color temperature from RGB- Supports 1000K-40000K range using Tanner Helland's algorithm
Improved
- Better Color Science: Added LAB color space for perceptually uniform calculations
- Enhanced Documentation: Comprehensive examples and usage patterns for new features
- Test Coverage: Extensive tests for all new blending, interpolation, and temperature functions
v1.0.4
[1.0.4] - 2025-09-17
Added
- CSS Color String Support: Full support for CSS
rgb()andrgba()color stringsvalid-css-rgb?andvalid-css-rgba?validation functionsparse-css-rgbandparse-css-rgbaparsing functionsnormalize-css-color-stringfor flexible formatting support
- Flexible CSS Format Support: Accepts various CSS color string formats:
- Comma-separated:
"rgb(255, 0, 0)","rgba(255, 0, 0, 0.5)" - Space-separated:
"rgb(255 0 0)","rgba(255 0 0 0.5)" - Case-insensitive:
"RGB(255, 0, 0)","RGBA(255, 0, 0, 1)" - Flexible whitespace:
"rgb( 255 , 0 , 0 )","rgba( 255 0 0 0.8 )" - Decimal alpha values:
"rgba(255, 0, 0, .5)"
- Comma-separated:
- Enhanced Color Input Handling: CSS color strings now work seamlessly with all library functions
- Color factory function:
(color "rgb(255, 0, 0)") - Universal conversion functions:
(->rgb "rgba(255, 0, 0, 0.8)") - Color manipulation:
(lighten "rgb(255, 0, 0)" 0.2) - All accessibility, analysis, and harmony functions
- Color factory function:
- Enhanced Color Factory:
colorfunction now accepts any color input type, including existing Color records - Universal Color Name Function: New
->namefunction that finds closest color names from any color input type - Unified Color Input Handling: Internal
normalize-color-inputfunction provides consistent color type handling across all functions - Comprehensive Test Coverage: Extensive tests for all CSS color string formats and edge cases
Improved
- Cross-platform Parsing: Added
parse-floatutility for consistent number parsing - Better Error Messages: Enhanced error reporting for invalid color string formats
- Input Validation: Stricter validation of CSS color string formats with helpful error messages
- Simplified API: All color manipulation functions now work seamlessly with any color input type
- Code Consistency: Refactored internal implementations to use unified color handling
- Better Type Safety: Enhanced validation and error handling for color inputs
- Performance: Reduced conditional logic through unified color processing
Technical Details
- Made
normalize-color-inputprivate for internal use - Enhanced
parse-intutility function for cross-platform compatibility - Improved RGBA vector handling in color factory function
- Consolidated color conversion logic for better maintainability
1.0.3
v1.0.0
jon/color-tools v0.1.0 - Initial Release
What's New
This initial release provides a complete toolkit for working with colors in Clojure applications, whether you're building web applications, data visualizations, or design tools.
Color Format Conversions
- Multi-format support: Convert seamlessly between HEX, RGB, RGBA, HSL, and HSV
- Input validation: Built-in validation for all color formats
- Example:
(hex->rgb "#ff5733")→[255 87 51]
Color Manipulation
- Adjust lightness:
lightenanddarkenfunctions - Saturation control:
saturateanddesaturate - Color transformations:
adjust-hue,invert,grayscale - Example:
(lighten "#ff5733" 0.2)→"#ff8566"
Color Harmony & Palettes
Generate beautiful color palettes using color theory:
- Complementary colors: Perfect color pairs
- Triadic & Tetradic: Balanced 3 and 4-color schemes
- Analogous: Harmonious neighboring colors
- Monochromatic: Elegant single-hue variations
- Example:
(generate-palette :triadic "#ff5733")→["#33ff57" "#5733ff"]
Accessibility Features
WCAG-compliant tools for inclusive design:
- Contrast checking:
contrast-ratio,accessible? - Smart color finding:
find-accessible-colorautomatically finds compliant alternatives - Example:
(accessible? "#000000" "#ffffff")→true
🔍 Color Analysis
Understand your colors better:
- Brightness analysis:
brightness,dark?,light? - Color temperature:
warm?,cool?,temperature - Vibrancy detection:
vibrant?,muted? - Color similarity:
color-distance,similar?
Color Names
- Built-in dictionary: 20+ common color names
- Name conversion:
name->hex,hex->name - Example:
(name->hex "red")→"#ff0000"
Cross-Platform
- Clojure (JVM): Full support for server-side applications
- ClojureScript: Complete browser and Node.js compatibility
- Comprehensive tests: Extensive test coverage ensures reliability
Installation
Add to your deps.edn:
{:deps {net.clojars.jon/color-tools {:mvn/version "0.1.0"}}}Or for Leiningen in project.clj:
[net.clojars.jon/color-tools "0.1.0"]Quick Start
(require '[jon.color-tools :as color])
;; Convert formats
(color/hex->rgb "#ff5733") ;=> [255 87 51]
(color/rgb->hsl [255 87 51]) ;=> [9 100 60]
;; Manipulate colors
(color/lighten "#ff5733" 0.3) ;=> "#ff9999"
(color/complementary "#ff5733") ;=> "#33ccff"
;; Check accessibility
(color/contrast-ratio "#000" "#fff") ;=> 21.0
(color/accessible? "#333" "#fff") ;=> true
;; Generate palettes
(color/analogous "#ff5733" 3 30) ;=> ["#ff8533" "#ffb333"]