struct
Foundation::Lab
- Foundation::Lab
- Struct
- Value
- Object
Overview
A CIELAB color using D65 reference white. Used for perceptual color distance. References for color constants and calculations for sRGB D65
- http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
- https://github.com/lucasb-eyer/go-colorful/blob/master/colors.go
Meta: Reopened so these methods live outside the record macro block but are still attached to the same struct.
Why do this? Because the crystal docs commands' wants_doc parser chokes on method docstring comments under the record macro.
Defined in:
foundation/color_space.cr:18foundation/color_space.cr:23
Constructors
Instance Method Summary
- #a : Float64
- #b : Float64
- #clone
- #copy_with(l _l = @l, a _a = @a, b _b = @b)
-
#distance(other : Lab) : Float64
ΔE76: the Euclidean distance between two Lab colors.
- #l : Float64
-
#to_rgb : RGB
Inverse of
RGB#to_lab, converts this CIELAB color back to 8bit sRGB (D65).
Constructor Detail
Instance Method Detail
ΔE76: the Euclidean distance between two Lab colors. Larger is more perceptually different.
Inverse of RGB#to_lab, converts this CIELAB color back to 8bit sRGB (D65).
Out-of-gamut Lab values are clamped into the sRGB cube, so this method always returns a valid RGB and never raises.
A round-trip may differ by +/-1 per channel because each trip rounds the conversion independently.