Skip to content

[css-color] Allow <angle> or <hue> in color() #4489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Crissov opened this issue Nov 6, 2019 · 5 comments
Closed

[css-color] Allow <angle> or <hue> in color() #4489

Crissov opened this issue Nov 6, 2019 · 5 comments
Labels
Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. css-color-4 Current Work

Comments

@Crissov
Copy link
Contributor

Crissov commented Nov 6, 2019

color() = color( [ <ident>? [ <number>+ | <string> ] [ / <alpha-value> ]? ]# , <color>? )

This allows either a named color or a tuple of unit-less numbers to identify or specify a color within a custom color space. Wouldnʼt it be useful to also support <percentage> (or <alpha-value> = <cmyk-component>) and <angle> (or <hue>) for custom color components since try are used in predefined color notations?

See #4477 for CIE lightness as a percentage.

@faceless2
Copy link

The values given to any ICC profile for conversion are 0 to 1. You can map percentages to this (and do, in #3450), but angles etc. would require knowledge which isn't readily available.

@Crissov
Copy link
Contributor Author

Crissov commented Nov 7, 2019

Oops! This issue is mostly a duplicate of #3450 indeed. I shall limit its scope to polar coordinates then, i. e. allowing one <angle>.

<color-component> = <number> | <percentage>

color(
     [ <ident>? 
       [ <string>
       | [ <angle>? || <color-component>+ ]
       ] 
       [ / <color-component> ]? 
     ]#
     [, <color> ]? 
     )

or more restrictive:

color(
     [ <ident>? 
       [ <string>
       | [ <angle> || <color-component>{0,2} ] 
       | <color-component>+ 
       ] 
       [ / <color-component> ]? 
     ]#
     [, <color> ]? 
     )

with the standard transformation

<computed-color-components> 
  = <first-non-angle | 100%>
  , <second-non-angle | 0%> * cos(<specified-angle>) 
  , <second-non-angle | 0%> * sin(<specified-angle>)

@Crissov Crissov changed the title [css-color] Allow <percentage> and <angle> in color() [css-color] Allow <angle> or <hue> in color() Nov 7, 2019
@Crissov
Copy link
Contributor Author

Crissov commented Nov 7, 2019

PS: @color-profile could get a descriptor to distinguish color space notations using names, channels (e. g. RGB and CMYK), Cartesian (e. g. Lab and Luv) or polar coordinates (i. e. anything with hue). UAs could then simply ignore uses of color() where the provided component types do not match the descriptor.

@svgeesus
Copy link
Contributor

Closing because the current spec allows percent already

color() = color( [ [<ident> | <dashed-ident>]? [ <number-percentage>+ | <string> ] 
[ / <alpha-value> ]? ]# , <color>? )

none of the predefined spaces in color() use a hue or angle, and ICC profiles take parameters in the range 0.0 to 1.0, not angles, as already mentioned.

@svgeesus svgeesus added the Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. label Apr 23, 2020
@Crissov
Copy link
Contributor Author

Crissov commented Apr 23, 2020

I expected nothing else. Perhaps I should have rephrased the issue to: Allow polar coordinates for arbitrary color spaces.

color([ <ident>? 
        [ <string>
        | <polar>
        | <component>+ 
        ] [ / <component> ]? 
      ]#[, <color> ]?)

<polar> = <hue|| <component>{0,2}
<component> = <number| <percentage>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed as Question Answered Used when the issue is more of a question than a problem, and it's been answered. css-color-4 Current Work
Projects
None yet
Development

No branches or pull requests

4 participants