-
Notifications
You must be signed in to change notification settings - Fork 747
Description
I might be overlooking something and I am not sure how to explain the issue fully.
So apologies in advance if this is a bit vague or if it was already answered.
I think there are a few things that are a bit hand-wavy in the current specification.
#a {
color: rgb(from rgb(0 0 0 / 50%) alpha 128 128 / 0.1);
}
Safari TP and WPT seem to agree that this is : rgba(128, 128, 128, 0.1)
Somehow the alpha value of 50%
or 0.5
got converted to 128
.
This makes sense if you consider that 50%
of 255
is 128
.
But I don't think the specification mentions the need for this conversion anywhere.
https://drafts.csswg.org/css-color-5/#relative-RGB
alpha is a
<number>
that corresponds to the origin color’s alpha transparency
So alpha
should be 0.5
, not 128
, when interpreting the specification naively.
#b {
color: hsl(from rgb(128 128 128 / 50%) alpha 50% 50% / 0.1);
}
#c {
color: hsl(0.5 50% 50% / 0.1);
}
#b
seems to be rgb(0, 0, 0)
(fallback to initial) but the reason isn't clear.
hsl
should be able to process hue values of type <number>
.
#c
has the same number value as I would expect alpha
to have and it works perfectly fine : rgba(191, 65, 64, 0.1)
.
What seems to be missing is a conversion table for when channel keywords are used in other channels.
- using
alpha
in ar
,g
,b
,h
, ... - using
r
,g
, ... inalpha
- ...