Skip to content

Commit

Permalink
Fix box-shadow combination of oklch and currentColor (#722)
Browse files Browse the repository at this point in the history
  • Loading branch information
magic-akari committed May 14, 2024
1 parent 029c88e commit 06ba62f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
20 changes: 20 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27182,6 +27182,26 @@ mod tests {
..Browsers::default()
},
);
prefix_test(
r#"
.foo {
box-shadow:
oklch(100% 0 0deg / 50%) 0 0.63rem 0.94rem -0.19rem,
currentColor 0 0.44rem 0.8rem -0.58rem;
}
"#,
indoc! { r#"
.foo {
box-shadow: 0 .63rem .94rem -.19rem #ffffff80, 0 .44rem .8rem -.58rem;
box-shadow: 0 .63rem .94rem -.19rem lab(100% 0 0 / .5), 0 .44rem .8rem -.58rem;
}
"#},
Browsers {
chrome: Some(95 << 16),
..Browsers::default()
},
);

prefix_test(
".foo { color: light-dark(var(--light), var(--dark)); }",
indoc! { r#"
Expand Down
4 changes: 2 additions & 2 deletions src/properties/box_shadow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ impl BoxShadowHandler {
let rgb = box_shadows
.iter()
.map(|shadow| BoxShadow {
color: shadow.color.to_rgb().unwrap(),
color: shadow.color.to_rgb().unwrap_or_else(|_| shadow.color.clone()),
..shadow.clone()
})
.collect();
Expand Down Expand Up @@ -236,7 +236,7 @@ impl BoxShadowHandler {
let lab = box_shadows
.iter()
.map(|shadow| BoxShadow {
color: shadow.color.to_lab().unwrap(),
color: shadow.color.to_lab().unwrap_or_else(|_| shadow.color.clone()),
..shadow.clone()
})
.collect();
Expand Down

0 comments on commit 06ba62f

Please sign in to comment.