ColorUtils class Null safety
This ColorUtils library contains the color space conversion methods used by the Chalk class to support alternate colors spaces from RGB. An attempt is made to be as versitle in input parameters as possible, many routines accept floating point numbers from 0.0-1.0 (for percentages) or alternately integers from 0-255. References with detailed explainations of the various color models included here https://en.wikipedia.org/wiki/HSL_and_HSV https://en.wikipedia.org/wiki/HWB_color_model Complete history of the X11 color names : https://en.wikipedia.org/wiki/X11_color_names and CSS color names (derived from X11 color names): https://www.w3.org/wiki/CSS/Properties/color/keywords Many of these routines are based on work by Heather Arthur and javascript code that I have ported to dart from: https://github.com/Qix-/color-convert/blob/master/conversions.js
Constructors
Properties
- hashCode → int
-
The hash code for this object.
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent 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 Properties
-
colorKeywords
→ Map<
String, int> -
A map of X11/CSS color keywords and their 6-digit hexadecimal RGB values
x11 colors appear again here:
https://www.w3.org/wiki/CSS/Properties/color/keywords
complete history of the X11 color names :
https://en.wikipedia.org/wiki/X11_color_names
and CSS color names (derived from X11 color names):
https://www.w3.org/wiki/CSS/Properties/color/keywords
(these are the same as the css color list (except for X11 has 'rebeccapurple'
and css colors used 'lightGoldenrodYellow' and X11 uses 'lightGoldenrod'))
final
Static Methods
-
addColorKeywordHex(
String colorname, dynamic hex) → void - Add hex color (string or int) to the colorKeywords[] map that is used for dynamic lookup of colors by name.
-
addColorKeywordRgb(
String colorname, int red, int green, int blue) → void - Add RGB color to the colorKeywords[] map that is used for dynamic lookup of colors by name.
-
cmyk2rgb(
num cyan, num magenta, num yellow, num keyBlack) → List< int> -
colorFromKeyword(
String keyword) → int - Lookup colorname keyword in colorKeywords map and return BLACK if the color is not found. Returns color as RGB int.
-
hex2rgb(
dynamic arg) → List< num> -
hsl2rgb(
num hue, num saturation, num lightness) → List< int> -
hslTorgb(
num hue, num sat, num light) → List< int> -
hslToRgb1Scale(
num hue, num sat, num light) → List< double> -
hsv2rgb(
num hue, num saturation, num valueBrightness) → List< int> -
hwb2rgb(
num h, num whiteness, num blackness) → List< int> - hwb2rgb algorithm from http://dev.w3.org/csswg/css-color/#hwb-to-rgb
-
hwbTorgb(
num hue, num white, num black) → List< int> -
lab2xyz(
num l, num a, num b) → List< num> -
rgb2hsl(
List< num> rgb) → List<int> -
rgbFromKeyword(
String keyword) → List< num> -
Lookup colorname keyword in colorKeywords map and return BLACK if the
color is not found.
Returns color as a num array of
[red,green,blue]
. -
rgbToAnsi256(
int red, int green, int blue) → int -
xyz2rgb(
num x, num y, num z) → List< int>