diff options
| author | Laurenz <laurmaedje@gmail.com> | 2025-06-19 17:20:45 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2025-06-20 17:32:37 +0200 |
| commit | 4580daf307cb1ba66458fb46d9442b1183731ec2 (patch) | |
| tree | bfe13587db10c858c4f5a638d216a38817dfbb7d /crates/typst-render | |
| parent | d821633f50f7f4c9edc49b6ac5e88d43802cb206 (diff) | |
More type-safe color conversions
Diffstat (limited to 'crates/typst-render')
| -rw-r--r-- | crates/typst-render/src/paint.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/typst-render/src/paint.rs b/crates/typst-render/src/paint.rs index ce92fd6a..6eb9c582 100644 --- a/crates/typst-render/src/paint.rs +++ b/crates/typst-render/src/paint.rs @@ -255,13 +255,13 @@ pub fn to_sk_paint<'a>( } pub fn to_sk_color(color: Color) -> sk::Color { - let [r, g, b, a] = color.to_rgb().to_vec4(); + let (r, g, b, a) = color.to_rgb().into_components(); sk::Color::from_rgba(r, g, b, a) .expect("components must always be in the range [0..=1]") } pub fn to_sk_color_u8(color: Color) -> sk::ColorU8 { - let [r, g, b, a] = color.to_rgb().to_vec4_u8(); + let (r, g, b, a) = color.to_rgb().into_format::<u8, u8>().into_components(); sk::ColorU8::from_rgba(r, g, b, a) } |
