grammar CssColor;

import BasePrimitives, CssUnit;

color
    : colorHSL      #color_hsl
    | colorHSLA     #color_hsla
    | colorRGB      #color_rgb
    | colorRGBA     #color_rgba
    | colorHEX      #color_hex
    | colorName     #color_name
    | colorTr       #color_tr
    ;

colorHSL
    : PREFIX_HSL LP h=componentHue CS s=componentSaturation CS l=componentLightness RP
    ;

colorHSLA
    : (PREFIX_HSL|PREFIX_HSLA) LP h=componentHue CS s=componentSaturation CS l=componentLightness CS alpha=componentAlpha RP
    ;

colorRGB
    : (PREFIX_RGB|PREFIX_RGBA) LP r=componentRGB CS g=componentRGB CS b=componentRGB RP
    ;

colorRGBA
    : PREFIX_RGBA LP r=componentRGB CS g=componentRGB CS b=componentRGB CS alpha=componentAlpha RP
    ;

colorHEX
    : codeHex
    ;

componentHue
    : numberInt
    | angle
    ;

componentSaturation
    : numberPct
    ;

componentLightness
    : numberPct
    ;

componentRGB
    : numberInt
    ;

componentAlpha
    : numberReal
    | numberInt
    ;

colorName : COLOR_NAME;

colorTr : COLOR_TRANSPARENT;

PREFIX_RGB   : 'rgb'  CHAR_WS*;
PREFIX_RGBA  : 'rgba' CHAR_WS*;
PREFIX_HSL   : 'hsl'  CHAR_WS*;
PREFIX_HSLA  : 'hsla' CHAR_WS*;

COLOR_TRANSPARENT
    : 'transparent'
    ;

COLOR_NAME
    : 'aliceblue'
    | 'antiquewhite'
    | 'aqua'
    | 'aquamarine'
    | 'azure'
    | 'beige'
    | 'bisque'
    | 'black'
    | 'blanchedalmond'
    | 'blue'
    | 'blueviolet'
    | 'brown'
    | 'burlywood'
    | 'cadetblue'
    | 'chartreuse'
    | 'chocolate'
    | 'coral'
    | 'cornflowerblue'
    | 'cornsilk'
    | 'crimson'
    | 'cyan'
    | 'darkblue'
    | 'darkcyan'
    | 'darkgoldenrod'
    | 'darkgray'
    | 'darkgreen'
    | 'darkgrey'
    | 'darkkhaki'
    | 'darkmagenta'
    | 'darkolivegreen'
    | 'darkorange'
    | 'darkorchid'
    | 'darkred'
    | 'darksalmon'
    | 'darkseagreen'
    | 'darkslateblue'
    | 'darkslategray'
    | 'darkslategrey'
    | 'darkturquoise'
    | 'darkviolet'
    | 'deeppink'
    | 'deepskyblue'
    | 'dimgray'
    | 'dimgrey'
    | 'dodgerblue'
    | 'firebrick'
    | 'floralwhite'
    | 'forestgreen'
    | 'fuchsia'
    | 'gainsboro'
    | 'ghostwhite'
    | 'gold'
    | 'goldenrod'
    | 'gray'
    | 'green'
    | 'greenyellow'
    | 'grey'
    | 'honeydew'
    | 'hotpink'
    | 'indianred'
    | 'indigo'
    | 'ivory'
    | 'khaki'
    | 'lavender'
    | 'lavenderblush'
    | 'lawngreen'
    | 'lemonchiffon'
    | 'lightblue'
    | 'lightcoral'
    | 'lightcyan'
    | 'lightgoldenrodyellow'
    | 'lightgray'
    | 'lightgreen'
    | 'lightgrey'
    | 'lightpink'
    | 'lightsalmon'
    | 'lightseagreen'
    | 'lightskyblue'
    | 'lightslategray'
    | 'lightslategrey'
    | 'lightsteelblue'
    | 'lightyellow'
    | 'lime'
    | 'limegreen'
    | 'linen'
    | 'magenta'
    | 'maroon'
    | 'mediumaquamarine'
    | 'mediumblue'
    | 'mediumorchid'
    | 'mediumpurple'
    | 'mediumseagreen'
    | 'mediumslateblue'
    | 'mediumspringgreen'
    | 'mediumturquoise'
    | 'mediumvioletred'
    | 'midnightblue'
    | 'mintcream'
    | 'mistyrose'
    | 'moccasin'
    | 'navajowhite'
    | 'navy'
    | 'oldlace'
    | 'olive'
    | 'olivedrab'
    | 'orange'
    | 'orangered'
    | 'orchid'
    | 'palegoldenrod'
    | 'palegreen'
    | 'paleturquoise'
    | 'palevioletred'
    | 'papayawhip'
    | 'peachpuff'
    | 'peru'
    | 'pink'
    | 'plum'
    | 'powderblue'
    | 'purple'
    | 'rebeccapurple'
    | 'red'
    | 'rosybrown'
    | 'royalblue'
    | 'saddlebrown'
    | 'salmon'
    | 'sandybrown'
    | 'seagreen'
    | 'seashell'
    | 'sienna'
    | 'silver'
    | 'skyblue'
    | 'slateblue'
    | 'slategray'
    | 'slategrey'
    | 'snow'
    | 'springgreen'
    | 'steelblue'
    | 'tan'
    | 'teal'
    | 'thistle'
    | 'tomato'
    | 'turquoise'
    | 'violet'
    | 'wheat'
    | 'white'
    | 'whitesmoke'
    | 'yellow'
    | 'yellowgreen'
    ;