Class ColorCssConverter

java.lang.Object
org.jhotdraw8.draw.css.converter.ColorCssConverter
All Implemented Interfaces:
org.jhotdraw8.base.converter.Converter<CssColor>, CssConverter<CssColor>

public class ColorCssConverter extends Object implements CssConverter<CssColor>
CssColorConverter.

Parses the following EBNF:

 CssColor ::= NamedColor | HexColor | ColorFunction  ;

 NamedColor ::= 'none' | TT_IDENT;

 HexColor ::= ('#'|'0x') , ( hexdigit * 3 | hexdigit * 4 | hexdigit * 6 | hexdigit * 8 );

 ColorFunction ::= RGBFunction | RGBAFunction
                 | HSBFunction | HSBAFunction
                 | HSLFunction | HSLAFunction
                 | HWBFunction
                 | LABFunction
                 | LCHFunction
                 | OKLABFunction
                 | OKLCHFunction
                 | COLORFunction
                 ;
 RGBFunction   ::= 'rgb('   , color-params , ')' ;
 RGBAFunction  ::= 'rgba('  , color-params , ')' ;
 HSBFunction   ::= 'hsb('   , color-params , ')' ;
 HSBAFunction  ::= 'hsba('   , color-params , ')' ;
 HSLFunction   ::= 'hsl('   , color-params , ')' ;
 HSLAFunction  ::= 'hsla('  , color-params , ')' ;
 HWBFunction   ::= 'hwb('   , color-params , ')' ;
 LABFunction   ::= 'lab('   , color-params , ')' ;
 OKLABFunction ::= 'oklab(' , color-params , ')' ;
 OKLCHFunction ::= 'oklch(' , color-params , ')' ;
 COLORFunction ::= 'color(' ,  color-params , ')' ;

 color-params  ::= [ color-space-param ] , ( ( number | angle | percentage | 'none' ) , [ "," ] ) * 3 , alpha-param ;
 alpha-param   ::= [ [ '/' ] ( number | percentage | 'none' ) ] ;
 color-space-param ::= 'srgb'
                     | 'srgb-linear'
                     | 'display-p3'
                     | 'a98-rgb'
                     | 'prophoto-rgb'
                     | 'rec2020'
                     | 'xyz'
                     | 'xyz-d50'
                     | 'xyz-d65'
                     ;
 

References:

CSS Color Module Level 4. 4. Representing Colors: the <color> type.
w3.org
CSS Color Module Level 4. 4. Representing Colors: the <color> type. 4.1 The <color> syntax.
w3.org
CSS Color Module Level 4. 5. sRGB Colors.
w3.org
JavaFX 20. JavaFX CSS Reference Guide. Types. <color>.
openjfx.io
Author:
Werner Randelshofer