diff options
| author | frozolotl <44589151+frozolotl@users.noreply.github.com> | 2024-02-20 15:33:41 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-20 14:33:41 +0000 |
| commit | 96fba58cf203ab4094fa56b9dee1a2137554c0b7 (patch) | |
| tree | 64e1e09c5bb41a54a26f6c80636932235ae8dd89 /crates/typst-render | |
| parent | 1ca3d9204a78545dc20712ff666089dec2c7227b (diff) | |
Fix color conversions (#3445)
Diffstat (limited to 'crates/typst-render')
| -rw-r--r-- | crates/typst-render/src/lib.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/typst-render/src/lib.rs b/crates/typst-render/src/lib.rs index fa4a9bf1..6fce5c94 100644 --- a/crates/typst-render/src/lib.rs +++ b/crates/typst-render/src/lib.rs @@ -1008,8 +1008,9 @@ fn render_pattern_frame(state: &State, pattern: &Pattern) -> sk::Pixmap { } fn to_sk_color(color: Color) -> sk::Color { - let [r, g, b, a] = color.to_rgb().to_vec4_u8(); - sk::Color::from_rgba8(r, g, b, a) + let [r, g, b, a] = color.to_rgb().to_vec4(); + sk::Color::from_rgba(r, g, b, a) + .expect("components must always be in the range [0..=1]") } fn to_sk_color_u8(color: Color) -> sk::ColorU8 { |
