diff options
| author | Sébastien d'Herbais de Thun <sebastien.d.herbais@gmail.com> | 2023-12-11 17:03:59 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-11 17:03:59 +0100 |
| commit | 343a423e9f07f4bccc41bc0a60a3a2251c8a228a (patch) | |
| tree | 99371e1980b3e6b62fce3ec7863f0f1c777d26cb /crates/typst-pdf/src | |
| parent | ce9d4204723a41abb62c3d0600a5c02900006866 (diff) | |
Fix #2902 (#2913)
Diffstat (limited to 'crates/typst-pdf/src')
| -rw-r--r-- | crates/typst-pdf/src/color.rs | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/crates/typst-pdf/src/color.rs b/crates/typst-pdf/src/color.rs index d7781b35..a758d935 100644 --- a/crates/typst-pdf/src/color.rs +++ b/crates/typst-pdf/src/color.rs @@ -255,7 +255,7 @@ pub trait ColorEncode { impl ColorEncode for ColorSpace { fn encode(&self, color: Color) -> [f32; 4] { match self { - ColorSpace::Oklab => { + ColorSpace::Oklab | ColorSpace::Oklch => { let [l, c, h, alpha] = color.to_oklch().to_vec4(); // Clamp on Oklch's chroma, not Oklab's a\* and b\* as to not distort hue. let c = c.clamp(0.0, 0.5); @@ -272,9 +272,6 @@ impl ColorEncode for ColorSpace { let [h, s, v, _] = color.to_hsv().to_vec4(); [h / 360.0, s, v, 0.0] } - ColorSpace::Oklch => { - unimplemented!("Oklch is always converted to Oklab first") - } _ => color.to_vec4(), } } |
