Changelog
Copy MarkdownAll notable changes to this project are documented here. The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Color version 0.4.0
Added
Color.LEDmodule with support for multi-channel addressable LED pixels that include extra white channels.Color.LED.RGBWcovers four-channel pixels (R, G, B, W) used by WS2814 and SK6812-RGBW.Color.LED.RGBWWcovers five-channel RGB+CCT pixels (R, G, B, WW, CW) used by WS2805 and several SK6812 variants. Both providefrom_srgb/2,to_srgb/1, andto_xyz/1.Color.LED.chip_options/1returns recommended extraction options for common chip variants (:ws2814_ww,:ws2814_nw,:ws2814_cw,:sk6812_ww,:sk6812_nw,:sk6812_cw,:ws2805).Color.ANSImodule for parsing and emitting ANSI SGR colour escape sequences. Supports 16-colour, 256-colour indexed, and 24-bit truecolor forms, with perceptual nearest-palette matching (CIEDE2000) when encoding to the 16- or 256-colour palette. Includesparse/1,to_string/2,wrap/3,nearest_256/1,nearest_16/1,palette_256/0,palette_16/0, and a typedColor.ANSI.ParseErrorexception.Top-level
Color.to_hex/1,Color.to_css/1,2, andColor.to_ansi/1,2convenience functions that accept any inputColor.new/1accepts and raise a typed exception on failure.
Changed
- Changed the module
Color.CSSNamestoColor.CSS.Names
Color version 0.3.0
Added
Twenty-one color-space struct modules covering CIE, modern perceptual, HDR, video, device, and web spaces:
Color.SRGB,Color.AdobeRGB,Color.RGB(linear, in any of 24 named working spaces),Color.Lab,Color.LCHab,Color.Luv,Color.LCHuv,Color.XYZ,Color.XyY,Color.Oklab,Color.Oklch,Color.HSLuv,Color.HPLuv,Color.HSL,Color.HSV,Color.CMYK,Color.YCbCr,Color.JzAzBz,Color.ICtCp,Color.IPT,Color.CAM16UCS.Top-level
Color.new/1,2,Color.convert/2,3,4,Color.convert_many/2,3,4,Color.luminance/1,Color.sort/2,Color.premultiply/1,Color.unpremultiply/1.Chromatic adaptation (
Color.XYZ.adapt/3) with six methods::bradford,:xyz_scaling,:von_kries,:sharp,:cmccat2000,:cat02.Color.XYZ.apply_bpc/3for black point compensation.ICC rendering intents wired into
Color.convert/3,4::relative_colorimetric(default),:absolute_colorimetric,:perceptual,:saturation. Optionalbpc: trueandadaptation:method override.Color.ICC.Profilematrix-profile reader covering ICC v2/v4 RGB→XYZ profiles withcurvLUT andparaparametric (types 0–4) tone response curves;load/1,parse/1,to_xyz/2,from_xyz/2.Color difference metrics (
Color.Distance): CIE76, CIE94, CIEDE2000 (verified against Sharma 2005), and CMC l:c.Contrast (
Color.Contrast): WCAG 2.x relative luminance and contrast ratio, APCA W3 0.1.9, contrast-awarepick_contrasting/2.Color mixing and gradients (
Color.Mix) with the default Oklab interpolation space and CSS Color 4 hue-interpolation modes.Gamut checking and mapping (
Color.Gamut) with both:clipand the CSS Color 4 Oklch binary-search perceptual algorithm.Color harmonies (
Color.Harmony) — complementary, analogous, triadic, tetradic, split-complementary — in any cylindrical space.Color temperature (
Color.Temperature): McCamy CCT, Planckian and CIE daylight loci,xyz/2.CSS Color Module Level 4 / 5 parser and serialiser (
Color.CSS): hex, named colors, all standard color functions,color()with display-p3 / a98-rgb / prophoto-rgb / rec2020 / xyz,device-cmyk(),color-mix(), relative color syntax,none, andcalc()expressions.CSS named colors (
Color.CSSNames): all 148 CSS Color Module Level 4 names pluschromagreenandchromablue. Atom and snake-case input. Reversenearest/1lookup via CIEDE2000.~COLORsigil (Color.Sigil) for compile-time color literals, compile-fenced behind Elixir 1.15.Spectral pipeline (
Color.Spectral+Color.Spectral.Tables): CIE 1931 2° and CIE 1964 10° standard observer CMFs, D65 / D50 / A / E illuminant SPDs, emissive and reflective integration, metamerism index.All sixteen CSS Compositing Level 1 blend modes (
Color.Blend).Transfer functions (
Color.Conversion.Lindbloom): sRGB, gamma 2.2 / 1.8, L*, BT.709, BT.2020, PQ (SMPTE ST 2084), HLG, Adobe RGB γ.Typed exception modules under
Color.*Errorfor every fallible function. Every error returns{:ok, _}or{:error, %SomeError{...}}with semantic fields.Public
Color.Behaviourdeclaring theto_xyz/1andfrom_xyz/1contract that every color-space struct module satisfies.Color.is_color/1andColor.is_css_name/1compile-time guards plusColor.color?/1,Color.css_name?/1, andColor.validate_transparency/1migration helpers.@type ton every public color-space struct module and@specannotations across the public API.Benchee benchmark suite under
bench/covering single-color conversions, batch vsEnum.map, and the:persistent_termworking-space cache.Property-based test suite (
test/property_test.exs) covering round-trip identity, alpha preservation, hue wrap-around, gamut-mapping invariance, ΔE symmetry, mix endpoint identity, and WCAG contrast bounds across every supported space.
Performance
Color.RGB.WorkingSpace.rgb_conversion_matrix/1results are cached in:persistent_termso repeated lookups for the same named space are constant-time after the first call.