csscolorvalue: Add color() support

Currently we only have sRGB, so it's a bit redundant, but we'll need this
for color-mix()

Once we have more color spaces, they should be added here (presumably the
enum would be in GDK instead, and instead of GdkRGBA these colors would
have a GdkColor.
This commit is contained in:
Alice Mikhaylenko
2024-05-22 18:31:36 +04:00
parent 6bd6c6acba
commit d51de390ba
6 changed files with 260 additions and 7 deletions

View File

@@ -95,3 +95,19 @@ w {
x {
color: rgba(255 0 0 / 0.5);
}
y {
color: color(srgb 1 0 0);
}
z {
color: color(srgb 99% 98.5% 98% / 0.5);
}
aa {
color: color(srgb 1.5 -150% 0 / 200%);
}
ab {
color: color(srgb-linear 1 0.5 0 / 50%);
}

View File

@@ -95,3 +95,19 @@ w {
x {
color: rgba(255,0,0,0.5);
}
y {
color: color(srgb 1 0 0);
}
z {
color: color(srgb 0.99 0.985 0.98 / 0.5);
}
aa {
color: color(srgb 1.5 -1.5 0);
}
ab {
color: color(srgb-linear 1 0.5 0 / 0.5);
}

View File

@@ -65,3 +65,23 @@ p {
q {
color: rgba(1, 2 3 / 4);
}
r {
color: color(not-a-color-space 255 0 0 / 0.5);
}
s {
color: color(srgb 255);
}
t {
color: color(srgb 1 0 0 0.5);
}
u {
color: color(srgb 1 0 / 0 0.5);
}
v {
color: color(srgb, 1, 0, 0);
}

View File

@@ -15,3 +15,8 @@ colors-errors.css:54:21-22: error: GTK_CSS_PARSER_ERROR_SYNTAX
colors-errors.css:58:22-23: error: GTK_CSS_PARSER_ERROR_SYNTAX
colors-errors.css:62:19-20: error: GTK_CSS_PARSER_ERROR_SYNTAX
colors-errors.css:66:20-21: error: GTK_CSS_PARSER_ERROR_SYNTAX
colors-errors.css:70:16-33: error: GTK_CSS_PARSER_ERROR_SYNTAX
colors-errors.css:74:24-25: error: GTK_CSS_PARSER_ERROR_SYNTAX
colors-errors.css:78:27-30: error: GTK_CSS_PARSER_ERROR_SYNTAX
colors-errors.css:82:25-26: error: GTK_CSS_PARSER_ERROR_SYNTAX
colors-errors.css:86:20-21: error: GTK_CSS_PARSER_ERROR_SYNTAX