Skip to content

[css-color] color({num}3,4) "shorthand"/alternate for rgb #275

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
grorg opened this issue Jul 6, 2016 · 7 comments
Closed

[css-color] color({num}3,4) "shorthand"/alternate for rgb #275

grorg opened this issue Jul 6, 2016 · 7 comments
Assignees
Labels
css-color-4 Current Work

Comments

@grorg
Copy link
Contributor

grorg commented Jul 6, 2016

We should consider a version of color() that doesn't take a profile name and defaults to a version of rgb() but with sensible parameters.

e.g. color(1.0 0 0) is red, or rgb(255, 0, 0)
e.g. color(0 1.0 0 0.5) is 50% transparent green, or rgba(0, 255, 0, 0.5)

Notice we don't have the weirdo mix of 0-255 and 0-1!!

In other words, if the first parameter is a number, the whole thing is a color in sRGB.

@frivoal
Copy link
Collaborator

frivoal commented Jul 8, 2016

I have no strong opinion for or against this. I can see why you may want this, but I don't think the need is that pressing. I'm OK either way.

However, if we do that, I think we should keep the coma between the optional color profile and the parameters, unlike what #266 is proposing.

I don't want color(0 0 1) to mean blue while color(O 0 1) (that's an upper case o) to mean the 0 1 color in the color profile defined by @profile O { src: url('O.icc'); }. This would be unambiguous for parsers, but error prone for humans.

If we have a comma in there, color(0 0 1) and color(O, 0 1) are still sort of close, but far enough in my view.

@svgeesus
Copy link
Contributor

svgeesus commented Jul 10, 2016

Notice we don't have the weirdo mix of 0-255 and 0-1!!

Yes. This is currently annoying, and gets more weird once people start using 10bit and 12bit components. is 50 50/255 or 50/4096? Keeping it all to a 0.0 ... 1.0 range is clear, bit depth neutral, and has no backwards-compat disadvantages.

@svgeesus
Copy link
Contributor

I noticed recently that canvas has two different behaviours: legacy sRGB, which means "this is supposed to be sRGB but eh, just throw the colors at the screen" and sRGB, which means "this really is sRGB, color manage it like any other calibrated colorspace"
I wonder therefore (we haven't got onto conformance criteria yet, but we will) whether rgb() might map to "legacy sRGB" and color() with the default sRGB colorpace map to "sRGB".

@Crissov
Copy link
Contributor

Crissov commented Jul 11, 2016

There already is consistent rgba(60%, 70%, 80%, 90%), though, which should arguably be equal to rgb(60%, 70%, 80%, 90%) or rgb(60% 70% 80%, 90%) orrgb(60% 70% 80% 90%).

@tabatkins
Copy link
Member

I wonder therefore (we haven't got onto conformance criteria yet, but we will) whether rgb() might map to "legacy sRGB" and color() with the default sRGB colorpace map to "sRGB".

No, CSS colors are color-managed sRGB.

@svgeesus
Copy link
Contributor

No, CSS colors are color-managed sRGB.

Happy to see you agree, I have been asserting that since 1996 and that is what all CSS1, CSS2 say but periodically people like to assert the opposite.

I just mentioned it since we should track what canvas is doing regarding color.

Getting back to the original issue, i agree that the first parameter to color() should be optional and, if omitted, default to sRGB.

@svgeesus svgeesus added the ready label Jul 24, 2016
@tabatkins
Copy link
Member

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-color-4 Current Work
Projects
None yet
Development

No branches or pull requests

5 participants