Re: [css4-color] #RGBA

Patrick Garies:
> On 2010-09-05 5:23 PM, Christoph Päper wrote:
>> 
>> hsla(180, 0, 0.5, 1).
> 
> 1. The saturation and lightness arguments are percentages on a range from 1-100, not 0-1.
> 2. Unlike other CSS values, the percentage (|%|) unit identifier is required even for values of zero.

Right, it was silly in a different way than I remembered.

You suggested ‘hsl(<hue>)’ in another message, when saturation and lightness are fixed. I think I’d want to write that simply as <angle>. I would suggest to just use percentages for values of gray, but I guess there are shorthand properties that could break then.

----8<--------8<--------8<--------8<--------8<--------8<--------8<----

  <color>     := named-color | color-space | hash-color | hue | gray
  named-color := svg-color | system-color | ‘transparent’ | current-color
  current-color := ‘current’ ‘-’? ‘color’
  svg-color   := html-color | x11-color
  html-color  := vga-color | ‘orange’
  vga-color   := ‘black’ | ‘silver’ | ‘gray’ | ‘white’
               | ‘red’ | ‘maroon’ | ‘purple’ | ‘fuchsia’
               | ‘green’ | ‘lime’ | ‘olive’ | ‘yellow’
               | ‘blue’ | ‘navy’ | ‘teal’ | ‘aqua’
  x11-color   := {long list of stupid keywords}
  color-space := rgb | hsl | cmyk
  rgb         := ‘rgb’ PARENOPEN red COMMA green COMMA blue PARENCLOSE
               | ‘rgba’ PARENOPEN red COMMA green COMMA blue COMMA alpha PARENCLOSE
  hsl         := ‘hsl’ PARENOPEN hue COMMA saturation COMMA lightness PARENCLOSE
               | ‘hsla’ PARENOPEN hue COMMA saturation COMMA lightness COMMA alpha PARENCLOSE
  cmyk        := ‘cmyk’ PARENOPEN cyan COMMA magenta COMMA yellow COMMA black PARENCLOSE
  gray, red, green, blue := 8BIT | PERCENTAGE
  saturation, lightness, alpha := PERCENTAGE
  cyan, magenta, yellow, black := PERCENTAGE
  hue         := <angle>  
  hash-color  := ‘#’ [ hex1 hex1 hex1 [ hex1 ]? | hex2 hex2 hex2 [ hex2 ]? ]
  hex1        := HEXDIGIT
  hex2        := HEXDIGIT HEXDIGIT

  COMMA       := S* ‘,’ S*
  PARENOPEN   := S* ‘(’ S*
  PARENCLOSE  := S* ‘)’ S*
  PERCENTAGE  := NN-NUMBER ‘%’
  GEN-NUMBER  := INTEGER | FLOAT
  POS-NUMBER  := ‘+’? GEN-NUMBER
  NEG-NUMBER  := ‘-’ GEN-NUMBER
  NN-NUMBER   := POS-NUMBER | 0
  NUMBER      := NN-NUMBER | NEG-NUMBER
  INTEGER     := [1-9] DIGIT*
  FLOAT       := [ 0 | INTEGER ]? ‘.’ DIGIT+
  8BIT        := [ [1-9]? | 1 DIGIT ] DIGIT | 2 [ [0-4] DIGIT | 5 [0-5] ]
  HEXDIGIT    := [0-9A-f]
  DIGIT       := [0-9]

(This does not at all accurately reflect <color> as currently specified.)

  <angle>     := degree | gon | rad | pirad | turn
  degree      := NUMBER ‘deg’
  gon         := NUMBER ‘grad’
  rad         := NUMBER ‘rad’
  pirad       := NUMBER ‘pi’
  turn        := NUMBER ‘turn’

Received on Friday, 10 September 2010 13:46:02 UTC