{"record":{"id":"2550558d7176a0d3","repo":"typst/typst","slug":"this-color-space-does-not-support-hue-rotation","errorCode":null,"errorMessage":"this color space does not support hue rotation","messagePattern":"this color space does not support hue rotation","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/typst-library/src/visualize/color.rs","lineNumber":1063,"sourceCode":"                Self::Process(ProcessColor::Oklch(rotated))\n                    .to_space(&self.space())\n                    .at(span)?\n            }\n            ProcessColorSpace::Hsl => {\n                let hsl = self.to_hsl();\n                let rotated = hsl.shift_hue(angle.to_deg() as f32);\n                Self::Process(ProcessColor::Hsl(rotated))\n                    .to_space(&self.space())\n                    .at(span)?\n            }\n            ProcessColorSpace::Hsv => {\n                let hsv = self.to_hsv();\n                let rotated = hsv.shift_hue(angle.to_deg() as f32);\n                Self::Process(ProcessColor::Hsv(rotated))\n                    .to_space(&self.space())\n                    .at(span)?\n            }\n            _ => bail!(span, \"this color space does not support hue rotation\"),\n        })\n    }\n\n    /// Create a color by mixing two or more colors.\n    ///\n    /// In color spaces with a hue component (HSL, HSV, Oklch), only two colors\n    /// can be mixed at once. Mixing more than two colors in such a space will\n    /// result in an error!\n    ///\n    /// ```example\n    /// #set block(height: 20pt, width: 100%)\n    /// #block(fill: red.mix(blue))\n    /// #block(fill: red.mix(blue, space: rgb))\n    /// #block(fill: color.mix(red, blue, white))\n    /// #block(fill: color.mix((red, 70%), (blue, 30%)))\n    /// ```\n    #[func(since = \"0.7.0\")]\n    pub fn mix(","sourceCodeStart":1045,"sourceCodeEnd":1081,"githubUrl":"https://github.com/typst/typst/blob/6a6f1a97a3446fc6ba5a723b0baf20a0cfeaaef5/crates/typst-library/src/visualize/color.rs#L1045-L1081","documentation":"Raised by Color::rotate when the color's current space has no hue channel (e.g. luma, oklab, rgb, cmyk). Hue rotation is only defined for hue-based spaces like oklch, hsl, and hsv; the guard rejects rotation in spaces where hue is not a component.","triggerScenarios":"Thrown at crates/typst-library/src/visualize/color.rs:1054 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Convert the color to oklch, hsl, or hsv before rotating the hue","Use color.to-space(color.oklch) then rotate, then convert back if needed","Pick a hue-based color space when hue manipulation is intended"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6a6f1a97a3446fc6ba5a723b0baf20a0cfeaaef5","analyzedAt":"2026-08-17T21:03:48.984Z","contentChangedAt":"2026-08-17T21:03:48.984Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}