Skip to content

Commit 7f59c00

Browse files
authored
fix: fix box-shadow combination of oklch and currentColor (#801)
1 parent 22ef664 commit 7f59c00

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/lib.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28019,6 +28019,25 @@ mod tests {
2801928019
..Browsers::default()
2802028020
},
2802128021
);
28022+
prefix_test(
28023+
r#"
28024+
.foo {
28025+
box-shadow:
28026+
oklch(100% 0 0deg / 50%) 0 0.63rem 0.94rem -0.19rem,
28027+
currentColor 0 0.44rem 0.8rem -0.58rem;
28028+
}
28029+
"#,
28030+
indoc! { r#"
28031+
.foo {
28032+
box-shadow: 0 .63rem .94rem -.19rem color(display-p3 1 1 1 / .5), 0 .44rem .8rem -.58rem;
28033+
box-shadow: 0 .63rem .94rem -.19rem lab(100% 0 0 / .5), 0 .44rem .8rem -.58rem;
28034+
}
28035+
"#},
28036+
Browsers {
28037+
safari: Some(14 << 16),
28038+
..Browsers::default()
28039+
},
28040+
);
2802228041

2802328042
prefix_test(
2802428043
".foo { color: light-dark(var(--light), var(--dark)); }",

src/properties/box_shadow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl BoxShadowHandler {
225225
let p3 = box_shadows
226226
.iter()
227227
.map(|shadow| BoxShadow {
228-
color: shadow.color.to_p3().unwrap(),
228+
color: shadow.color.to_p3().unwrap_or_else(|_| shadow.color.clone()),
229229
..shadow.clone()
230230
})
231231
.collect();

0 commit comments

Comments
 (0)