Hsluv class
Human-friendly HSL conversion utility class. The math for most of this module was taken from:
- http://www.easyrgb.com
- http://www.brucelindbloom.com
-
Wikipedia All numbers below taken from math/bounds.wxm wxMaxima file. We use 17 digits of decimal precision to export the numbers, effectively exporting them as double precision IEEE 754 floats. "If an IEEE 754 double precision is converted to a decimal string with at least 17 significant digits and then converted back to double, then the final number must match the original" Source: https://en.wikipedia.org/wiki/Double-precision_floating-point_format
Constructors
- Hsluv()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
dotProduct(
List< double> a, List<double> b) → double -
fromLinear(
double c) → double -
getBounds(
double L) → List< Line> - For a given lightness, return a list of 6 lines in slope-intercept form that represent the bounds in CIELUV, stepping over which will push a value out of the RGB gamut
-
hexToHpluv(
String s) → List< double> -
HSLuv values are ranging in
0;360
,0;100
and0;100
and RGB in0;1
. @param hex A#RRGGBB
representation of a color. @return An array containing the color's HSL values in HPLuv (pastel variant) color space. */ -
hexToHsluv(
String s) → List< double> -
HSLuv values are ranging in
0;360
,0;100
and0;100
and RGB in0;1
. @param tuple An array containing the color's HSL values in HPLuv (pastel variant) color space. @return An array containing the color's HSL values in HSLuv color space. */ -
hexToRgb(
String hex) → List< double> -
RGB values are ranging in
0;1
. @param hex A#RRGGBB
representation of a color. @return An array containing the color's RGB values. -
hpluvToHex(
List< double> tuple) → String -
hpluvToLch(
List< double> tuple) → List<double> -
HSLuv values are in
0;360
,0;100
and0;100
. @param tuple An array containing the color's H,S,L values in HPLuv (pastel variant) color space. @return An array containing the resulting color's LCH coordinates. -
hpluvToRgb(
List< double> tuple) → List<double> -
HSLuv values are ranging in
0;360
,0;100
and0;100
and RGB in0;1
. @param tuple An array containing the color's HSL values in HPLuv (pastel variant) color space. @return An array containing the resulting color's RGB coordinates. -
hsluvToHex(
List< double> tuple) → String -
HSLuv values are ranging in
0;360
,0;100
and0;100
and RGB in0;1
. @param tuple An array containing the color's HSL values in HSLuv color space. @return A string containing a#RRGGBB
representation of given color. */ -
hsluvToLch(
List< double> tuple) → List<double> -
HSLuv values are ranging in
0;360
,0;100
and0;100
. @param tuple An array containing the color's H,S,L values in HSLuv color space. @return An array containing the resulting color's LCH coordinates. -
hsluvToRgb(
List< double> tuple) → List<double> -
HSLuv values are ranging in
0;360
,0;100
and0;100
and RGB in0;1
. @param tuple An array containing the color's HSL values in HSLuv color space. @return An array containing the resulting color's RGB coordinates. -
lchToHpluv(
List< double> tuple) → List<double> -
HSLuv values are ranging in
0;360
,0;100
and0;100
. @param tuple An array containing the color's LCH values. @return An array containing the resulting color's HSL coordinates in HPLuv (pastel variant) color space. -
lchToHsluv(
List< double> tuple) → List<double> -
HSLuv values are ranging in
0;360
,0;100
and0;100
. @param tuple An array containing the color's LCH values. @return An array containing the resulting color's HSL coordinates in HSLuv color space. -
lchToLuv(
List< double> tuple) → List<double> - @param tuple An array containing the color's L,C,H values. @return An array containing the resulting color's LUV coordinates.
-
lchToRgb(
List< double> tuple) → List<double> -
RGB values are ranging in
0;1
. @param tuple An array containing the color's LCH values. @return An array containing the resulting color's RGB coordinates. -
lToY(
double L) → double -
luvToLch(
List< double> tuple) → List<double> - @param tuple An array containing the color's L,U,V values. @return An array containing the resulting color's LCH coordinates.
-
luvToXyz(
List< double> tuple) → List<double> -
XYZ coordinates are ranging in
0;1
. @param tuple An array containing the color's L,U,V values. @return An array containing the resulting color's XYZ coordinates. -
maxChromaForLH(
double L, double H) → double -
maxSafeChromaForL(
double L) → double - For given lightness, returns the maximum chroma. Keeping the chroma value below this number will ensure that for any hue, the color is within the RGB gamut.
-
rgbToHex(
List< double> tuple) → String -
RGB values are ranging in
0;1
. @param tuple An array containing the color's RGB values. @return A string containing a#RRGGBB
representation of given color. -
rgbToHpluv(
List< double> tuple) → List<double> -
HSLuv values are ranging in
0;360
,0;100
and0;100
and RGB in0;1
. @param tuple An array containing the color's RGB coordinates. @return An array containing the resulting color's HSL coordinates in HPLuv (pastel variant) color space. -
rgbToHsluv(
List< double> tuple) → List<double> -
HSLuv values are ranging in
0;360
,0;100
and0;100
and RGB in0;1
. @param tuple An array containing the color's RGB coordinates. @return An array containing the resulting color's HSL coordinates in HSLuv color space. -
rgbToLch(
List< double> tuple) → List<double> -
RGB values are ranging in
0;1
. @param tuple An array containing the color's RGB values. @return An array containing the resulting color's LCH coordinates. -
rgbToXyz(
List< double> tuple) → List<double> -
RGB coordinates are ranging in
0;1
and XYZ coordinates in0;1
. @param tuple An array containing the color's R,G,B values. @return An array containing the resulting color's XYZ coordinates. -
toLinear(
double c) → double -
xyzToLuv(
List< double> tuple) → List<double> -
XYZ coordinates are ranging in
0;1
. @param tuple An array containing the color's X,Y,Z values. @return An array containing the resulting color's LUV coordinates. -
xyzToRgb(
List< double> tuple) → List<double> -
XYZ coordinates are ranging in
0;1
and RGB coordinates in0;1
range. @param tuple An array containing the color's X,Y and Z values. @return An array containing the resulting color's red, green and blue. -
yToL(
double Y) → double - http://en.wikipedia.org/wiki/CIELUV In these formulas, Yn refers to the reference white point. We are usin g illuminant D65, so Yn (see refY in Maxima file) equals 1. The formula is simplified accordingly.