Re: [css4-color] 4 Parameters in RGB() and HSL()

Tab Atkins Jr.:

> Your third example - rgb(255, 0, 64, 127) - will always be invalid,
> though - CSS can't distinguish between <integer> and <number> in
> general, so the fact that alpha already takes a number in [0,1] means
> we can't also have it take an integer in [0,255],

<alpha> can only and must be used – unless we allow <percentage> as an alternative – when the function name ends in an ‘a’, otherwise the transparency value is given as either <percentage> (always for HSL) or <integer>, iff red, green and blue are also provided as integers in the range [0,255]. 

We had previously in implementations

 ·  rgb(<integer|percentage>, <integer|percentage>, <integer|percentage>)

We had already

 ·  rgb(<integer>, <integer>, <integer>)
 ·  rgb(<percentage>, <percentage>, <percentage>)
 ·  #RGB
 ·  #RRGGBB

We have now additionally

 ·  rgba(<integer>, <integer>, <integer>, <alpha>)
 ·  rgba(<percentage>, <percentage>, <percentage>, <alpha>)
 ·  hsl(<angle>, <percentage>, <percentage>)
 ·  hsla(<angle>, <percentage>, <percentage>, <alpha>)

We should have

 +  rgb(<integer>, <integer>, <integer>, <integer>)                  !
 +  rgb(<percentage>, <percentage>, <percentage>, <percentage>)
 +  hsl(<angle>, <percentage>, <percentage>, <percentage>)
 +  gray(<percentage>)
 +  gray(<percentage>, <percentage>)
 +  gray(<percentage>, <alpha>)
 +  #RGBA
 +  #RRGGBBAA

We may have

 +  rgba(<integer>, <integer>, <integer>, <percentage>)
 +  rgba(<percentage>, <percentage>, <percentage>, <percentage>)
 +  hsla(<angle>, <percentage>, <percentage>, <percentage>)
 +  gray(<integer>)
 +  gray(<integer>, <integer>) or gray(<integer>, <alpha>)
 +  gray(<integer>, <percentage>)

We should not have

 –  rgb(<integer>, <integer>, <integer>, <percentage>)
 –  rgb(<percentage>, <percentage>, <percentage>, <alpha>)
 –  hsl(<angle>, <percentage>, <percentage>, <alpha>)
 –  #W
 –  #WA nor #WW
 –  #RGBAA
 –  #RRGGBBA

We cannot have, assuming ‘should haves’ above

 –  rgb(<integer>, <integer>, <integer>, <alpha>)                    !
 –  #WWAA

We cannot have

 –  rgba(<percentage>, <percentage>, <percentage>, <integer>)
 –  rgba(<integer>, <integer>, <integer>, <integer>)
 –  hsla(<angle>, <percentage>, <percentage>, <integer>)
 –  #WAA
 –  #WWA

We must not have, or cannot have if ‘should not haves’ existed

 –  rgb(<percentage>, <percentage>, <percentage>, <integer>)
 –  hsl(<angle>, <percentage>, <percentage>, <integer>)

Received on Thursday, 26 January 2012 09:17:18 UTC