Skip to content

Commit 889b2ea

Browse files
committed
feat: shadow color string
1 parent 3249019 commit 889b2ea

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

crates/canvas-2d/src/context/shadows.rs

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::os::raw::c_float;
33
use skia_safe::Color;
44

55
use crate::context::Context;
6+
use crate::utils::color::parse_color;
67

78
impl Context {
89
pub fn set_shadow_blur(&mut self, blur: c_float) {
@@ -34,6 +35,12 @@ impl Context {
3435
self.state.shadow_color = color;
3536
}
3637

38+
pub fn set_shadow_color_str(&mut self, color: &str) {
39+
if let Some(color) = parse_color(color) {
40+
self.state.shadow_color = color;
41+
}
42+
}
43+
3744
pub fn set_shadow_color_rgba(&mut self, r: u8, g: u8, b: u8, a: u8) {
3845
self.state.shadow_color = Color::from_argb(a, r, g, b);
3946
}

0 commit comments

Comments
 (0)