-
Notifications
You must be signed in to change notification settings - Fork 636
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-values-4][css-color-4] Resolve <percentage>
to <number>
as a color component in math functions
#8485
Comments
It seems there are a few other productions in which the range to resolve It seems a bit odd that a naked |
Please use this link to get an up-to-date view of drafts (updates every 5 minutes): https://w3c.github.io/csswg-drafts/ The changes you mention were made two days ago and here they are |
I think the general point you raise is worth some further discussion, so re-opening |
I am not sure what context / behavior should be considered to further discuss about resolving
edit: After re-reading this issue, I assume the general point was resolving Excluding in math functions and color functions, resolving a value specified as a For For Another (probably more interesting) point is why I guess it would be weird if Chrome/FF resolves |
Unrelated to math functions but somewhat related to this issue, I changed the percent to number mappings for |
I edited my previous comment. Basically, the relevant questions are:
|
Re-reading this issue, I am not sure what the remaining problems are, if any. The spec has changed several times since the issue was opened, and to me at least now seems clear:
and
and this seems to work in practice live test: let test = document.createElement("div");
test.style.color = "rgb(90 calc(100%) 100%)";
console.log(test.style.color); Firefox correctly reports
and Safari and Chrome do not seem to implement mixed number and percent in modern |
Right, back-compatibility requires serializing I ask why this should also apply in other color functions (and also for whatever property value defined with
|
Closing in favor of #9395, which describes the problem better. |
The definitions of
rgb()
,rgba()
,hsl()
,hsla()
, has recently received two modifications in CSS Color 4 (not yet visible online at this time), which allow to mix<number>
and<percentage>
arguments. Basically:With the new syntax, my problem is that
calc(100%)
now resolves to1
.CSS Values 4 defines the simplification of a mathematical function representing
<percentage>
:To find out if I can resolve a
root
percentage, I am currently looking for<number> | <percentage>
or<integer> | <percentage>
(in any order) as contexts, thereforecalc(100%)
is not resolved inrgb()
defined with the syntax that does not mix<number>
and<percentage>
.CSS Color 4 does not require to resolve
<percentage>
inrgb()
andrgba()
(aside: it is required for non-sRGB color functions), but requires to serialize it as a base 10<number>
in the range [0-255].In Chrome/FF,
rgb(calc(100%) 0% 0%)
serializes torgb(255, 0, 0)
as a specified value.I am not sure if the right way to solve my problem is to consider that there is not enough information to resolve a percentage in a math function as an argument of
rgb()
andrgba()
, regardless of their syntax (separated/mixed<number>
and<percentage>
). This would mean that determining if there is enough information to resolve it as a<number>
cannot be simply based on if the context is<number> | <percentage>
or<integer> | <percentage>
.The text was updated successfully, but these errors were encountered: