Skip to content
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

[css-color] Merge Lab() and LCH() in CIE()? #4481

Closed
Crissov opened this issue Nov 4, 2019 · 2 comments
Closed

[css-color] Merge Lab() and LCH() in CIE()? #4481

Crissov opened this issue Nov 4, 2019 · 2 comments

Comments

@Crissov
Copy link
Contributor

Crissov commented Nov 4, 2019

With CIE lightness becoming a <percentage> per #4477, it becomes possible to unify Lab and LCH in a single functional notation. Iʼm not sure this is a useful thing to do, but perhaps others do.

CIELAB a and b might not be percentages in disguise, but CIELUV u and v apparently are.

cie() = cie( 
 /* Lab */    <number>{3} 
 /* Lab */ | [<percentage> && <number>{2}] 
 /* Luv */ |  <percentage>{3} 
 /* Luv */ | [<number> && <percentage>{2}] 
 /* LCH */ | [<number>{2} && <angle>] 
 /* LCH */ | [<percentage> && <number> && <angle>] 
           [ / <alpha-value> ]? 
           ) 

By this reasoning, though, rgb() should consequently also support <angle> && <percentage>{2} for either HSL or HWB, or <angle> <percentage>{2} for one of them and <percentage>{2} <angle> for the other.

rgb() = rgb(
 /* RGB */    <number>{3} 
 /* RGB */ |  <percentage>{3}
 /* HSL */ | [<angle> <percentage>{2}] 
 /* HWB */ | [<percentage>{2} <angle>] 
           [ / <alpha-value> ]? 
           )
@tabatkins
Copy link
Member

Ooh, I really don't think this is a good idea. The fact that the grammars don't technically clash doesn't mean merging them makes sense.

We're not trying to conserve function names here; that namespace is wide open. Having the color functions all be separate functions that name their arguments in the same fashion seems far friendlier to authors than asking them to memorize a number of argument-order patterns and divine which color space is being used.

@Crissov
Copy link
Contributor Author

Crissov commented Nov 5, 2019

Iʼm absolutely fine with rejecting this idea, although Luv support might still be worthwhile. It originally was just a point in favor of enforcing explicit units wherever they apply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants