{"route":"/en-US-v0.13.1/reference/visualize/color/","title":"Color","description":"Documentation for the Color type.","part":null,"outline":[{"id":"summary","name":"Summary","children":[]},{"id":"example","name":"Example","children":[]},{"id":"predefined-colors","name":"Predefined colors","children":[]},{"id":"predefined-color-maps","name":"Predefined color maps","children":[]},{"id":"definitions","name":"Definitions","children":[{"id":"definitions-luma","name":"Luma","children":[{"id":"definitions-luma-lightness","name":"lightness","children":[]},{"id":"definitions-luma-alpha","name":"alpha","children":[]},{"id":"definitions-luma-color","name":"color","children":[]}]},{"id":"definitions-oklab","name":"Oklab","children":[{"id":"definitions-oklab-lightness","name":"lightness","children":[]},{"id":"definitions-oklab-a","name":"a","children":[]},{"id":"definitions-oklab-b","name":"b","children":[]},{"id":"definitions-oklab-alpha","name":"alpha","children":[]},{"id":"definitions-oklab-color","name":"color","children":[]}]},{"id":"definitions-oklch","name":"Oklch","children":[{"id":"definitions-oklch-lightness","name":"lightness","children":[]},{"id":"definitions-oklch-chroma","name":"chroma","children":[]},{"id":"definitions-oklch-hue","name":"hue","children":[]},{"id":"definitions-oklch-alpha","name":"alpha","children":[]},{"id":"definitions-oklch-color","name":"color","children":[]}]},{"id":"definitions-linear-rgb","name":"Linear RGB","children":[{"id":"definitions-linear-rgb-red","name":"red","children":[]},{"id":"definitions-linear-rgb-green","name":"green","children":[]},{"id":"definitions-linear-rgb-blue","name":"blue","children":[]},{"id":"definitions-linear-rgb-alpha","name":"alpha","children":[]},{"id":"definitions-linear-rgb-color","name":"color","children":[]}]},{"id":"definitions-rgb","name":"RGB","children":[{"id":"definitions-rgb-red","name":"red","children":[]},{"id":"definitions-rgb-green","name":"green","children":[]},{"id":"definitions-rgb-blue","name":"blue","children":[]},{"id":"definitions-rgb-alpha","name":"alpha","children":[]},{"id":"definitions-rgb-hex","name":"hex","children":[]},{"id":"definitions-rgb-color","name":"color","children":[]}]},{"id":"definitions-cmyk","name":"CMYK","children":[{"id":"definitions-cmyk-cyan","name":"cyan","children":[]},{"id":"definitions-cmyk-magenta","name":"magenta","children":[]},{"id":"definitions-cmyk-yellow","name":"yellow","children":[]},{"id":"definitions-cmyk-key","name":"key","children":[]},{"id":"definitions-cmyk-color","name":"color","children":[]}]},{"id":"definitions-hsl","name":"HSL","children":[{"id":"definitions-hsl-hue","name":"hue","children":[]},{"id":"definitions-hsl-saturation","name":"saturation","children":[]},{"id":"definitions-hsl-lightness","name":"lightness","children":[]},{"id":"definitions-hsl-alpha","name":"alpha","children":[]},{"id":"definitions-hsl-color","name":"color","children":[]}]},{"id":"definitions-hsv","name":"HSV","children":[{"id":"definitions-hsv-hue","name":"hue","children":[]},{"id":"definitions-hsv-saturation","name":"saturation","children":[]},{"id":"definitions-hsv-value","name":"value","children":[]},{"id":"definitions-hsv-alpha","name":"alpha","children":[]},{"id":"definitions-hsv-color","name":"color","children":[]}]},{"id":"definitions-components","name":"Components","children":[{"id":"definitions-components-alpha","name":"alpha","children":[]}]},{"id":"definitions-space","name":"Space","children":[]},{"id":"definitions-to-hex","name":"To Hex","children":[]},{"id":"definitions-lighten","name":"Lighten","children":[{"id":"definitions-lighten-factor","name":"factor","children":[]}]},{"id":"definitions-darken","name":"Darken","children":[{"id":"definitions-darken-factor","name":"factor","children":[]}]},{"id":"definitions-saturate","name":"Saturate","children":[{"id":"definitions-saturate-factor","name":"factor","children":[]}]},{"id":"definitions-desaturate","name":"Desaturate","children":[{"id":"definitions-desaturate-factor","name":"factor","children":[]}]},{"id":"definitions-negate","name":"Negate","children":[{"id":"definitions-negate-space","name":"space","children":[]}]},{"id":"definitions-rotate","name":"Rotate","children":[{"id":"definitions-rotate-angle","name":"angle","children":[]},{"id":"definitions-rotate-space","name":"space","children":[]}]},{"id":"definitions-mix","name":"Mix","children":[{"id":"definitions-mix-colors","name":"colors","children":[]},{"id":"definitions-mix-space","name":"space","children":[]}]},{"id":"definitions-transparentize","name":"Transparentize","children":[{"id":"definitions-transparentize-scale","name":"scale","children":[]}]},{"id":"definitions-opacify","name":"Opacify","children":[{"id":"definitions-opacify-scale","name":"scale","children":[]}]}]}],"body":{"kind":"type","content":{"name":"color","title":"Color","keywords":[],"oneliner":"A color in a specific color space.","details":"<p>A color in a specific color space.</p>\n<p>Typst supports:</p>\n<ul>\n<li>sRGB through the <a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-rgb\"><code>rgb</code> function</a></li>\n<li>Device CMYK through <a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-cmyk\"><code>cmyk</code> function</a></li>\n<li>D65 Gray through the <a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-luma\"><code>luma</code> function</a></li>\n<li>Oklab through the <a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-oklab\"><code>oklab</code> function</a></li>\n<li>Oklch through the <a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-oklch\"><code>oklch</code> function</a></li>\n<li>Linear RGB through the <a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-linear-rgb\"><code>color.linear-rgb</code> function</a></li>\n<li>HSL through the <a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-hsl\"><code>color.hsl</code> function</a></li>\n<li>HSV through the <a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-hsv\"><code>color.hsv</code> function</a></li>\n</ul>\n<h2 id=\"example\">Example</h2>\n<div class=\"previewed-code\"><pre><code><span class=\"typ-func\">#</span><span class=\"typ-func\">rect</span><span class=\"typ-punct\">(</span>fill<span class=\"typ-punct\">:</span> aqua<span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/93eeb087697d4d35e63e1cd9c696a18d.png\" alt=\"Preview\"></div></div>\n<h2 id=\"predefined-colors\">Predefined colors</h2>\n<p>Typst defines the following built-in colors:</p>\n<table><thead><tr><th>Color</th><th style=\"text-align: left\">Definition</th></tr></thead><tbody>\n<tr><td><code>black</code></td><td style=\"text-align: left\"><code><span class=\"typ-func\">luma</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">0</span><span class=\"typ-punct\">)</span></code></td></tr>\n<tr><td><code>gray</code></td><td style=\"text-align: left\"><code><span class=\"typ-func\">luma</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">170</span><span class=\"typ-punct\">)</span></code></td></tr>\n<tr><td><code>silver</code></td><td style=\"text-align: left\"><code><span class=\"typ-func\">luma</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">221</span><span class=\"typ-punct\">)</span></code></td></tr>\n<tr><td><code>white</code></td><td style=\"text-align: left\"><code><span class=\"typ-func\">luma</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">255</span><span class=\"typ-punct\">)</span></code></td></tr>\n<tr><td><code>navy</code></td><td style=\"text-align: left\"><code><span class=\"typ-func\">rgb</span><span class=\"typ-punct\">(</span><span class=\"typ-str\">&quot;#001f3f&quot;</span><span class=\"typ-punct\">)</span></code></td></tr>\n<tr><td><code>blue</code></td><td style=\"text-align: left\"><code><span class=\"typ-func\">rgb</span><span class=\"typ-punct\">(</span><span class=\"typ-str\">&quot;#0074d9&quot;</span><span class=\"typ-punct\">)</span></code></td></tr>\n<tr><td><code>aqua</code></td><td style=\"text-align: left\"><code><span class=\"typ-func\">rgb</span><span class=\"typ-punct\">(</span><span class=\"typ-str\">&quot;#7fdbff&quot;</span><span class=\"typ-punct\">)</span></code></td></tr>\n<tr><td><code>teal</code></td><td style=\"text-align: left\"><code><span class=\"typ-func\">rgb</span><span class=\"typ-punct\">(</span><span class=\"typ-str\">&quot;#39cccc&quot;</span><span class=\"typ-punct\">)</span></code></td></tr>\n<tr><td><code>eastern</code></td><td style=\"text-align: left\"><code><span class=\"typ-func\">rgb</span><span class=\"typ-punct\">(</span><span class=\"typ-str\">&quot;#239dad&quot;</span><span class=\"typ-punct\">)</span></code></td></tr>\n<tr><td><code>purple</code></td><td style=\"text-align: left\"><code><span class=\"typ-func\">rgb</span><span class=\"typ-punct\">(</span><span class=\"typ-str\">&quot;#b10dc9&quot;</span><span class=\"typ-punct\">)</span></code></td></tr>\n<tr><td><code>fuchsia</code></td><td style=\"text-align: left\"><code><span class=\"typ-func\">rgb</span><span class=\"typ-punct\">(</span><span class=\"typ-str\">&quot;#f012be&quot;</span><span class=\"typ-punct\">)</span></code></td></tr>\n<tr><td><code>maroon</code></td><td style=\"text-align: left\"><code><span class=\"typ-func\">rgb</span><span class=\"typ-punct\">(</span><span class=\"typ-str\">&quot;#85144b&quot;</span><span class=\"typ-punct\">)</span></code></td></tr>\n<tr><td><code>red</code></td><td style=\"text-align: left\"><code><span class=\"typ-func\">rgb</span><span class=\"typ-punct\">(</span><span class=\"typ-str\">&quot;#ff4136&quot;</span><span class=\"typ-punct\">)</span></code></td></tr>\n<tr><td><code>orange</code></td><td style=\"text-align: left\"><code><span class=\"typ-func\">rgb</span><span class=\"typ-punct\">(</span><span class=\"typ-str\">&quot;#ff851b&quot;</span><span class=\"typ-punct\">)</span></code></td></tr>\n<tr><td><code>yellow</code></td><td style=\"text-align: left\"><code><span class=\"typ-func\">rgb</span><span class=\"typ-punct\">(</span><span class=\"typ-str\">&quot;#ffdc00&quot;</span><span class=\"typ-punct\">)</span></code></td></tr>\n<tr><td><code>olive</code></td><td style=\"text-align: left\"><code><span class=\"typ-func\">rgb</span><span class=\"typ-punct\">(</span><span class=\"typ-str\">&quot;#3d9970&quot;</span><span class=\"typ-punct\">)</span></code></td></tr>\n<tr><td><code>green</code></td><td style=\"text-align: left\"><code><span class=\"typ-func\">rgb</span><span class=\"typ-punct\">(</span><span class=\"typ-str\">&quot;#2ecc40&quot;</span><span class=\"typ-punct\">)</span></code></td></tr>\n<tr><td><code>lime</code></td><td style=\"text-align: left\"><code><span class=\"typ-func\">rgb</span><span class=\"typ-punct\">(</span><span class=\"typ-str\">&quot;#01ff70&quot;</span><span class=\"typ-punct\">)</span></code></td></tr>\n</tbody></table>\n<p>The predefined colors and the most important color constructors are\navailable globally and also in the color type's scope, so you can write\neither <code>color.red</code> or just <code>red</code>.</p>\n<div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/216bd4010ab6d547b5ceef60c23721fa.png\" alt=\"Preview\"></div>\n<h2 id=\"predefined-color-maps\">Predefined color maps</h2>\n<p>Typst also includes a number of preset color maps that can be used for\n<a href=\"/en-US-v0.13.1/reference/visualize/gradient/#definitions-linear\">gradients</a>. These are simply arrays of colors defined in\nthe module <code>color.map</code>.</p>\n<div class=\"previewed-code\"><pre><code><span class=\"typ-func\">#</span><span class=\"typ-func\">circle</span><span class=\"typ-punct\">(</span>fill<span class=\"typ-punct\">:</span> gradient<span class=\"typ-punct\">.</span><span class=\"typ-func\">linear</span><span class=\"typ-punct\">(</span><span class=\"typ-op\">..</span>color<span class=\"typ-punct\">.</span>map<span class=\"typ-punct\">.</span>crest<span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/b86ea2560990c07ffaffed4de36c8a1f.png\" alt=\"Preview\"></div></div><table><thead><tr><th>Map</th><th style=\"text-align: left\">Details</th></tr></thead><tbody>\n<tr><td><code>turbo</code></td><td style=\"text-align: left\">A perceptually uniform rainbow-like color map. Read <a href=\"https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html\">this blog post</a> for more details.</td></tr>\n<tr><td><code>cividis</code></td><td style=\"text-align: left\">A blue to gray to yellow color map. See <a href=\"https://bids.github.io/colormap/\">this blog post</a> for more details.</td></tr>\n<tr><td><code>rainbow</code></td><td style=\"text-align: left\">Cycles through the full color spectrum. This color map is best used by setting the interpolation color space to <a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-hsl\">HSL</a>. The rainbow gradient is <strong>not suitable</strong> for data visualization because it is not perceptually uniform, so the differences between values become unclear to your readers. It should only be used for decorative purposes.</td></tr>\n<tr><td><code>spectral</code></td><td style=\"text-align: left\">Red to yellow to blue color map.</td></tr>\n<tr><td><code>viridis</code></td><td style=\"text-align: left\">A purple to teal to yellow color map.</td></tr>\n<tr><td><code>inferno</code></td><td style=\"text-align: left\">A black to red to yellow color map.</td></tr>\n<tr><td><code>magma</code></td><td style=\"text-align: left\">A black to purple to yellow color map.</td></tr>\n<tr><td><code>plasma</code></td><td style=\"text-align: left\">A purple to pink to yellow color map.</td></tr>\n<tr><td><code>rocket</code></td><td style=\"text-align: left\">A black to red to white color map.</td></tr>\n<tr><td><code>mako</code></td><td style=\"text-align: left\">A black to teal to yellow color map.</td></tr>\n<tr><td><code>vlag</code></td><td style=\"text-align: left\">A light blue to white to red color map.</td></tr>\n<tr><td><code>icefire</code></td><td style=\"text-align: left\">A light teal to black to yellow color map.</td></tr>\n<tr><td><code>flare</code></td><td style=\"text-align: left\">A orange to purple color map that is perceptually uniform.</td></tr>\n<tr><td><code>crest</code></td><td style=\"text-align: left\">A blue to white to red color map.</td></tr>\n</tbody></table>\n<p>Some popular presets are not included because they are not available under a\nfree licence. Others, like\n<a href=\"https://jakevdp.github.io/blog/2014/10/16/how-bad-is-your-colormap/\">Jet</a>,\nare not included because they are not color blind friendly. Feel free to use\nor create a package with other presets that are useful to you!</p>\n<div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/4b6131a130d12b7d177fdc1725b58866.png\" alt=\"Preview\"></div>","constructor":null,"scope":[{"path":["color"],"name":"luma","title":"Luma","keywords":[],"oneliner":"Create a grayscale color.","element":false,"contextual":false,"deprecation":null,"details":"<p>Create a grayscale color.</p>\n<p>A grayscale color is represented internally by a single <code>lightness</code>\ncomponent.</p>\n<p>These components are also available using the\n<a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-components\"><code>components</code></a> method.</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">for</span> x <span class=\"typ-key\">in</span> <span class=\"typ-func\">range</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">250</span><span class=\"typ-punct\">,</span> step<span class=\"typ-punct\">:</span> <span class=\"typ-num\">50</span><span class=\"typ-punct\">)</span> <span class=\"typ-punct\">{</span>\n  <span class=\"typ-func\">box</span><span class=\"typ-punct\">(</span><span class=\"typ-func\">square</span><span class=\"typ-punct\">(</span>fill<span class=\"typ-punct\">:</span> <span class=\"typ-func\">luma</span><span class=\"typ-punct\">(</span>x<span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-punct\">}</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/6c24ce5a43ada433e3b83da23e04da8d.png\" alt=\"Preview\"></div></div>","self":false,"params":[{"name":"lightness","details":"<p>The lightness component.</p>","example":null,"types":["int","ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"alpha","details":"<p>The alpha component.</p>","example":null,"types":["ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"color","details":"<p>Alternatively: The color to convert to grayscale.</p>\n<p>If this is given, the <code>lightness</code> should not be given.</p>","example":null,"types":["color"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["color"],"scope":[]},{"path":["color"],"name":"oklab","title":"Oklab","keywords":[],"oneliner":"Create an [Oklab](https://bottosson.github.io/posts/oklab/) color.","element":false,"contextual":false,"deprecation":null,"details":"<p>Create an <a href=\"https://bottosson.github.io/posts/oklab/\">Oklab</a> color.</p>\n<p>This color space is well suited for the following use cases:</p>\n<ul>\n<li>Color manipulation such as saturating while keeping perceived hue</li>\n<li>Creating grayscale images with uniform perceived lightness</li>\n<li>Creating smooth and uniform color transition and gradients</li>\n</ul>\n<p>A linear Oklab color is represented internally by an array of four\ncomponents:</p>\n<ul>\n<li>lightness (<a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>)</li>\n<li>a (<a href=\"/en-US-v0.13.1/reference/foundations/float/\" title=\"`float`\"><code>float</code></a> or <a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>.\nRatios are relative to <code><span class=\"typ-num\">0.4</span></code>; meaning <code><span class=\"typ-num\">50%</span></code> is equal to <code><span class=\"typ-num\">0.2</span></code>)</li>\n<li>b (<a href=\"/en-US-v0.13.1/reference/foundations/float/\" title=\"`float`\"><code>float</code></a> or <a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>.\nRatios are relative to <code><span class=\"typ-num\">0.4</span></code>; meaning <code><span class=\"typ-num\">50%</span></code> is equal to <code><span class=\"typ-num\">0.2</span></code>)</li>\n<li>alpha (<a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>)</li>\n</ul>\n<p>These components are also available using the\n<a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-components\"><code>components</code></a> method.</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-func\">#</span><span class=\"typ-func\">square</span><span class=\"typ-punct\">(</span>\n  fill<span class=\"typ-punct\">:</span> <span class=\"typ-func\">oklab</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">27%</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">20%</span><span class=\"typ-punct\">,</span> <span class=\"typ-op\">-</span><span class=\"typ-num\">3%</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">50%</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/d5d1b30dbc1d63361be4dcc913343314.png\" alt=\"Preview\"></div></div>","self":false,"params":[{"name":"lightness","details":"<p>The lightness component.</p>","example":null,"types":["ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"a","details":"<p>The a (&quot;green/red&quot;) component.</p>","example":null,"types":["float","ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"b","details":"<p>The b (&quot;blue/yellow&quot;) component.</p>","example":null,"types":["float","ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"alpha","details":"<p>The alpha component.</p>","example":null,"types":["ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"color","details":"<p>Alternatively: The color to convert to Oklab.</p>\n<p>If this is given, the individual components should not be given.</p>","example":null,"types":["color"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["color"],"scope":[]},{"path":["color"],"name":"oklch","title":"Oklch","keywords":[],"oneliner":"Create an [Oklch](https://bottosson.github.io/posts/oklab/) color.","element":false,"contextual":false,"deprecation":null,"details":"<p>Create an <a href=\"https://bottosson.github.io/posts/oklab/\">Oklch</a> color.</p>\n<p>This color space is well suited for the following use cases:</p>\n<ul>\n<li>Color manipulation involving lightness, chroma, and hue</li>\n<li>Creating grayscale images with uniform perceived lightness</li>\n<li>Creating smooth and uniform color transition and gradients</li>\n</ul>\n<p>A linear Oklch color is represented internally by an array of four\ncomponents:</p>\n<ul>\n<li>lightness (<a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>)</li>\n<li>chroma (<a href=\"/en-US-v0.13.1/reference/foundations/float/\" title=\"`float`\"><code>float</code></a> or <a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>.\nRatios are relative to <code><span class=\"typ-num\">0.4</span></code>; meaning <code><span class=\"typ-num\">50%</span></code> is equal to <code><span class=\"typ-num\">0.2</span></code>)</li>\n<li>hue (<a href=\"/en-US-v0.13.1/reference/layout/angle/\" title=\"`angle`\"><code>angle</code></a>)</li>\n<li>alpha (<a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>)</li>\n</ul>\n<p>These components are also available using the\n<a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-components\"><code>components</code></a> method.</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-func\">#</span><span class=\"typ-func\">square</span><span class=\"typ-punct\">(</span>\n  fill<span class=\"typ-punct\">:</span> <span class=\"typ-func\">oklch</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">40%</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">0.2</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">160deg</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">50%</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/80426dd4f0691936a37149b8e92f8936.png\" alt=\"Preview\"></div></div>","self":false,"params":[{"name":"lightness","details":"<p>The lightness component.</p>","example":null,"types":["ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"chroma","details":"<p>The chroma component.</p>","example":null,"types":["float","ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"hue","details":"<p>The hue component.</p>","example":null,"types":["angle"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"alpha","details":"<p>The alpha component.</p>","example":null,"types":["ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"color","details":"<p>Alternatively: The color to convert to Oklch.</p>\n<p>If this is given, the individual components should not be given.</p>","example":null,"types":["color"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["color"],"scope":[]},{"path":["color"],"name":"linear-rgb","title":"Linear RGB","keywords":[],"oneliner":"Create an RGB(A) color with linear luma.","element":false,"contextual":false,"deprecation":null,"details":"<p>Create an RGB(A) color with linear luma.</p>\n<p>This color space is similar to sRGB, but with the distinction that the\ncolor component are not gamma corrected. This makes it easier to perform\ncolor operations such as blending and interpolation. Although, you\nshould prefer to use the <a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-oklab\"><code>oklab</code> function</a> for these.</p>\n<p>A linear RGB(A) color is represented internally by an array of four\ncomponents:</p>\n<ul>\n<li>red (<a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>)</li>\n<li>green (<a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>)</li>\n<li>blue (<a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>)</li>\n<li>alpha (<a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>)</li>\n</ul>\n<p>These components are also available using the\n<a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-components\"><code>components</code></a> method.</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-func\">#</span><span class=\"typ-func\">square</span><span class=\"typ-punct\">(</span>fill<span class=\"typ-punct\">:</span> color<span class=\"typ-punct\">.</span><span class=\"typ-func\">linear-rgb</span><span class=\"typ-punct\">(</span>\n  <span class=\"typ-num\">30%</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">50%</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">10%</span><span class=\"typ-punct\">,</span>\n<span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/b7f5d6072aad409a0124394f175f691.png\" alt=\"Preview\"></div></div>","self":false,"params":[{"name":"red","details":"<p>The red component.</p>","example":null,"types":["int","ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"green","details":"<p>The green component.</p>","example":null,"types":["int","ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"blue","details":"<p>The blue component.</p>","example":null,"types":["int","ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"alpha","details":"<p>The alpha component.</p>","example":null,"types":["int","ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"color","details":"<p>Alternatively: The color to convert to linear RGB(A).</p>\n<p>If this is given, the individual components should not be given.</p>","example":null,"types":["color"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["color"],"scope":[]},{"path":["color"],"name":"rgb","title":"RGB","keywords":[],"oneliner":"Create an RGB(A) color.","element":false,"contextual":false,"deprecation":null,"details":"<p>Create an RGB(A) color.</p>\n<p>The color is specified in the sRGB color space.</p>\n<p>An RGB(A) color is represented internally by an array of four components:</p>\n<ul>\n<li>red (<a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>)</li>\n<li>green (<a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>)</li>\n<li>blue (<a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>)</li>\n<li>alpha (<a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>)</li>\n</ul>\n<p>These components are also available using the <a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-components\"><code>components</code></a>\nmethod.</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-func\">#</span><span class=\"typ-func\">square</span><span class=\"typ-punct\">(</span>fill<span class=\"typ-punct\">:</span> <span class=\"typ-func\">rgb</span><span class=\"typ-punct\">(</span><span class=\"typ-str\">&quot;#b1f2eb&quot;</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">square</span><span class=\"typ-punct\">(</span>fill<span class=\"typ-punct\">:</span> <span class=\"typ-func\">rgb</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">87</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">127</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">230</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">square</span><span class=\"typ-punct\">(</span>fill<span class=\"typ-punct\">:</span> <span class=\"typ-func\">rgb</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">25%</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">13%</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">65%</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/7968af65b92aee8168b4cd3a39e2bdd8.png\" alt=\"Preview\"></div></div>","self":false,"params":[{"name":"red","details":"<p>The red component.</p>","example":null,"types":["int","ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"green","details":"<p>The green component.</p>","example":null,"types":["int","ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"blue","details":"<p>The blue component.</p>","example":null,"types":["int","ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"alpha","details":"<p>The alpha component.</p>","example":null,"types":["int","ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"hex","details":"<p>Alternatively: The color in hexadecimal notation.</p>\n<p>Accepts three, four, six or eight hexadecimal digits and optionally\na leading hash.</p>\n<p>If this is given, the individual components should not be given.</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-func\">#</span><span class=\"typ-func\">text</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">16pt</span><span class=\"typ-punct\">,</span> <span class=\"typ-func\">rgb</span><span class=\"typ-punct\">(</span><span class=\"typ-str\">&quot;#239dad&quot;</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">[</span>\n  <span class=\"typ-strong\">*Typst*</span>\n<span class=\"typ-punct\">]</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/aca7c8b7a9ea4b3a01457b7b93b04c3b.png\" alt=\"Preview\"></div></div>","types":["str"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"color","details":"<p>Alternatively: The color to convert to RGB(a).</p>\n<p>If this is given, the individual components should not be given.</p>","example":null,"types":["color"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["color"],"scope":[]},{"path":["color"],"name":"cmyk","title":"CMYK","keywords":[],"oneliner":"Create a CMYK color.","element":false,"contextual":false,"deprecation":null,"details":"<p>Create a CMYK color.</p>\n<p>This is useful if you want to target a specific printer. The conversion\nto RGB for display preview might differ from how your printer reproduces\nthe color.</p>\n<p>A CMYK color is represented internally by an array of four components:</p>\n<ul>\n<li>cyan (<a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>)</li>\n<li>magenta (<a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>)</li>\n<li>yellow (<a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>)</li>\n<li>key (<a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>)</li>\n</ul>\n<p>These components are also available using the\n<a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-components\"><code>components</code></a> method.</p>\n<p>Note that CMYK colors are not currently supported when PDF/A output is\nenabled.</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-func\">#</span><span class=\"typ-func\">square</span><span class=\"typ-punct\">(</span>\n  fill<span class=\"typ-punct\">:</span> <span class=\"typ-func\">cmyk</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">27%</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">0%</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">3%</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">5%</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/d4b1e282da4509956348db3cddf3f478.png\" alt=\"Preview\"></div></div>","self":false,"params":[{"name":"cyan","details":"<p>The cyan component.</p>","example":null,"types":["ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"magenta","details":"<p>The magenta component.</p>","example":null,"types":["ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"yellow","details":"<p>The yellow component.</p>","example":null,"types":["ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"key","details":"<p>The key component.</p>","example":null,"types":["ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"color","details":"<p>Alternatively: The color to convert to CMYK.</p>\n<p>If this is given, the individual components should not be given.</p>","example":null,"types":["color"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["color"],"scope":[]},{"path":["color"],"name":"hsl","title":"HSL","keywords":[],"oneliner":"Create an HSL color.","element":false,"contextual":false,"deprecation":null,"details":"<p>Create an HSL color.</p>\n<p>This color space is useful for specifying colors by hue, saturation and\nlightness. It is also useful for color manipulation, such as saturating\nwhile keeping perceived hue.</p>\n<p>An HSL color is represented internally by an array of four components:</p>\n<ul>\n<li>hue (<a href=\"/en-US-v0.13.1/reference/layout/angle/\" title=\"`angle`\"><code>angle</code></a>)</li>\n<li>saturation (<a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>)</li>\n<li>lightness (<a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>)</li>\n<li>alpha (<a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>)</li>\n</ul>\n<p>These components are also available using the\n<a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-components\"><code>components</code></a> method.</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-func\">#</span><span class=\"typ-func\">square</span><span class=\"typ-punct\">(</span>\n  fill<span class=\"typ-punct\">:</span> color<span class=\"typ-punct\">.</span><span class=\"typ-func\">hsl</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">30deg</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">50%</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">60%</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/32a4753614fe9bf2260435f6de163bc6.png\" alt=\"Preview\"></div></div>","self":false,"params":[{"name":"hue","details":"<p>The hue angle.</p>","example":null,"types":["angle"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"saturation","details":"<p>The saturation component.</p>","example":null,"types":["int","ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"lightness","details":"<p>The lightness component.</p>","example":null,"types":["int","ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"alpha","details":"<p>The alpha component.</p>","example":null,"types":["int","ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"color","details":"<p>Alternatively: The color to convert to HSL.</p>\n<p>If this is given, the individual components should not be given.</p>","example":null,"types":["color"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["color"],"scope":[]},{"path":["color"],"name":"hsv","title":"HSV","keywords":[],"oneliner":"Create an HSV color.","element":false,"contextual":false,"deprecation":null,"details":"<p>Create an HSV color.</p>\n<p>This color space is useful for specifying colors by hue, saturation and\nvalue. It is also useful for color manipulation, such as saturating\nwhile keeping perceived hue.</p>\n<p>An HSV color is represented internally by an array of four components:</p>\n<ul>\n<li>hue (<a href=\"/en-US-v0.13.1/reference/layout/angle/\" title=\"`angle`\"><code>angle</code></a>)</li>\n<li>saturation (<a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>)</li>\n<li>value (<a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>)</li>\n<li>alpha (<a href=\"/en-US-v0.13.1/reference/layout/ratio/\" title=\"`ratio`\"><code>ratio</code></a>)</li>\n</ul>\n<p>These components are also available using the\n<a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-components\"><code>components</code></a> method.</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-func\">#</span><span class=\"typ-func\">square</span><span class=\"typ-punct\">(</span>\n  fill<span class=\"typ-punct\">:</span> color<span class=\"typ-punct\">.</span><span class=\"typ-func\">hsv</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">30deg</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">50%</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">60%</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/7443a35ccc65557f31800b8c145fa091.png\" alt=\"Preview\"></div></div>","self":false,"params":[{"name":"hue","details":"<p>The hue angle.</p>","example":null,"types":["angle"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"saturation","details":"<p>The saturation component.</p>","example":null,"types":["int","ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"value","details":"<p>The value component.</p>","example":null,"types":["int","ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"alpha","details":"<p>The alpha component.</p>","example":null,"types":["int","ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"color","details":"<p>Alternatively: The color to convert to HSL.</p>\n<p>If this is given, the individual components should not be given.</p>","example":null,"types":["color"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["color"],"scope":[]},{"path":["color"],"name":"components","title":"Components","keywords":[],"oneliner":"Extracts the components of this color.","element":false,"contextual":false,"deprecation":null,"details":"<p>Extracts the components of this color.</p>\n<p>The size and values of this array depends on the color space. You can\nobtain the color space using <a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-space\"><code>space</code></a>. Below is a table\nof the color spaces and their components:</p>\n<table><thead><tr><th>Color space</th><th>C1</th><th>C2</th><th>C3</th><th>C4</th></tr></thead><tbody>\n<tr><td><a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-luma\"><code>luma</code></a></td><td>Lightness</td><td></td><td></td><td></td></tr>\n<tr><td><a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-oklab\"><code>oklab</code></a></td><td>Lightness</td><td><code>a</code></td><td><code>b</code></td><td>Alpha</td></tr>\n<tr><td><a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-oklch\"><code>oklch</code></a></td><td>Lightness</td><td>Chroma</td><td>Hue</td><td>Alpha</td></tr>\n<tr><td><a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-linear-rgb\"><code>linear-rgb</code></a></td><td>Red</td><td>Green</td><td>Blue</td><td>Alpha</td></tr>\n<tr><td><a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-rgb\"><code>rgb</code></a></td><td>Red</td><td>Green</td><td>Blue</td><td>Alpha</td></tr>\n<tr><td><a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-cmyk\"><code>cmyk</code></a></td><td>Cyan</td><td>Magenta</td><td>Yellow</td><td>Key</td></tr>\n<tr><td><a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-hsl\"><code>hsl</code></a></td><td>Hue</td><td>Saturation</td><td>Lightness</td><td>Alpha</td></tr>\n<tr><td><a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-hsv\"><code>hsv</code></a></td><td>Hue</td><td>Saturation</td><td>Value</td><td>Alpha</td></tr>\n</tbody></table>\n<p>For the meaning and type of each individual value, see the documentation\nof the corresponding color space. The alpha component is optional and\nonly included if the <code>alpha</code> argument is <code>true</code>. The length of the\nreturned array depends on the number of components and whether the alpha\ncomponent is included.</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-comment\">// note that the alpha component is included by default</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">rgb</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">40%</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">60%</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">80%</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">.</span><span class=\"typ-func\">components</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/77307f77341fe1233f3aed1e01c147f4.png\" alt=\"Preview\"></div></div>","self":true,"params":[{"name":"alpha","details":"<p>Whether to include the alpha component.</p>","example":null,"types":["bool"],"strings":[],"default":"<code><span class=\"typ-key\">true</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":false}],"returns":["array"],"scope":[]},{"path":["color"],"name":"space","title":"Space","keywords":[],"oneliner":"Returns the constructor function for this color's space:","element":false,"contextual":false,"deprecation":null,"details":"<p>Returns the constructor function for this color's space:</p>\n<ul>\n<li><a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-luma\"><code>luma</code></a></li>\n<li><a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-oklab\"><code>oklab</code></a></li>\n<li><a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-oklch\"><code>oklch</code></a></li>\n<li><a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-linear-rgb\"><code>linear-rgb</code></a></li>\n<li><a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-rgb\"><code>rgb</code></a></li>\n<li><a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-cmyk\"><code>cmyk</code></a></li>\n<li><a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-hsl\"><code>hsl</code></a></li>\n<li><a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-hsv\"><code>hsv</code></a></li>\n</ul>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">let</span> color <span class=\"typ-op\">=</span> <span class=\"typ-func\">cmyk</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">1%</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">2%</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">3%</span><span class=\"typ-punct\">,</span> <span class=\"typ-num\">4%</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-punct\">#</span><span class=\"typ-punct\">(</span>color<span class=\"typ-punct\">.</span><span class=\"typ-func\">space</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span> <span class=\"typ-op\">==</span> cmyk<span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/b5f89cffa16ef490db9384f3dab62028.png\" alt=\"Preview\"></div></div>","self":true,"params":[],"returns":["any"],"scope":[]},{"path":["color"],"name":"to-hex","title":"To Hex","keywords":[],"oneliner":"Returns the color's RGB(A) hex representation (such as `#ffaa32` or","element":false,"contextual":false,"deprecation":null,"details":"<p>Returns the color's RGB(A) hex representation (such as <code>#ffaa32</code> or\n<code>#020304fe</code>). The alpha component (last two digits in <code>#020304fe</code>) is\nomitted if it is equal to <code>ff</code> (255 / 100%).</p>","example":null,"self":true,"params":[],"returns":["str"],"scope":[]},{"path":["color"],"name":"lighten","title":"Lighten","keywords":[],"oneliner":"Lightens a color by a given factor.","element":false,"contextual":false,"deprecation":null,"details":"<p>Lightens a color by a given factor.</p>","example":null,"self":true,"params":[{"name":"factor","details":"<p>The factor to lighten the color by.</p>","example":null,"types":["ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["color"],"scope":[]},{"path":["color"],"name":"darken","title":"Darken","keywords":[],"oneliner":"Darkens a color by a given factor.","element":false,"contextual":false,"deprecation":null,"details":"<p>Darkens a color by a given factor.</p>","example":null,"self":true,"params":[{"name":"factor","details":"<p>The factor to darken the color by.</p>","example":null,"types":["ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["color"],"scope":[]},{"path":["color"],"name":"saturate","title":"Saturate","keywords":[],"oneliner":"Increases the saturation of a color by a given factor.","element":false,"contextual":false,"deprecation":null,"details":"<p>Increases the saturation of a color by a given factor.</p>","example":null,"self":true,"params":[{"name":"factor","details":"<p>The factor to saturate the color by.</p>","example":null,"types":["ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["color"],"scope":[]},{"path":["color"],"name":"desaturate","title":"Desaturate","keywords":[],"oneliner":"Decreases the saturation of a color by a given factor.","element":false,"contextual":false,"deprecation":null,"details":"<p>Decreases the saturation of a color by a given factor.</p>","example":null,"self":true,"params":[{"name":"factor","details":"<p>The factor to desaturate the color by.</p>","example":null,"types":["ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["color"],"scope":[]},{"path":["color"],"name":"negate","title":"Negate","keywords":[],"oneliner":"Produces the complementary color using a provided color space.","element":false,"contextual":false,"deprecation":null,"details":"<p>Produces the complementary color using a provided color space.\nYou can think of it as the opposite side on a color wheel.</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-func\">#</span><span class=\"typ-func\">square</span><span class=\"typ-punct\">(</span>fill<span class=\"typ-punct\">:</span> yellow<span class=\"typ-punct\">)</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">square</span><span class=\"typ-punct\">(</span>fill<span class=\"typ-punct\">:</span> yellow<span class=\"typ-punct\">.</span><span class=\"typ-func\">negate</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">square</span><span class=\"typ-punct\">(</span>fill<span class=\"typ-punct\">:</span> yellow<span class=\"typ-punct\">.</span><span class=\"typ-func\">negate</span><span class=\"typ-punct\">(</span>space<span class=\"typ-punct\">:</span> rgb<span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/a015995bf8bf799f00f4aff8eb05cb69.png\" alt=\"Preview\"></div></div>","self":true,"params":[{"name":"space","details":"<p>The color space used for the transformation. By default, a perceptual color space is used.</p>","example":null,"types":["any"],"strings":[],"default":"<code>oklab</code>","positional":false,"named":true,"required":false,"variadic":false,"settable":false}],"returns":["color"],"scope":[]},{"path":["color"],"name":"rotate","title":"Rotate","keywords":[],"oneliner":"Rotates the hue of the color by a given angle.","element":false,"contextual":false,"deprecation":null,"details":"<p>Rotates the hue of the color by a given angle.</p>","example":null,"self":true,"params":[{"name":"angle","details":"<p>The angle to rotate the hue by.</p>","example":null,"types":["angle"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false},{"name":"space","details":"<p>The color space used to rotate. By default, this happens in a perceptual\ncolor space (<a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-oklch\"><code>oklch</code></a>).</p>","example":null,"types":["any"],"strings":[],"default":"<code>oklch</code>","positional":false,"named":true,"required":false,"variadic":false,"settable":false}],"returns":["color"],"scope":[]},{"path":["color"],"name":"mix","title":"Mix","keywords":[],"oneliner":"Create a color by mixing two or more colors.","element":false,"contextual":false,"deprecation":null,"details":"<p>Create a color by mixing two or more colors.</p>\n<p>In color spaces with a hue component (hsl, hsv, oklch), only two colors\ncan be mixed at once. Mixing more than two colors in such a space will\nresult in an error!</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">set</span> <span class=\"typ-func\">block</span><span class=\"typ-punct\">(</span>height<span class=\"typ-punct\">:</span> <span class=\"typ-num\">20pt</span><span class=\"typ-punct\">,</span> width<span class=\"typ-punct\">:</span> <span class=\"typ-num\">100%</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">block</span><span class=\"typ-punct\">(</span>fill<span class=\"typ-punct\">:</span> red<span class=\"typ-punct\">.</span><span class=\"typ-func\">mix</span><span class=\"typ-punct\">(</span>blue<span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">block</span><span class=\"typ-punct\">(</span>fill<span class=\"typ-punct\">:</span> red<span class=\"typ-punct\">.</span><span class=\"typ-func\">mix</span><span class=\"typ-punct\">(</span>blue<span class=\"typ-punct\">,</span> space<span class=\"typ-punct\">:</span> rgb<span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">block</span><span class=\"typ-punct\">(</span>fill<span class=\"typ-punct\">:</span> color<span class=\"typ-punct\">.</span><span class=\"typ-func\">mix</span><span class=\"typ-punct\">(</span>red<span class=\"typ-punct\">,</span> blue<span class=\"typ-punct\">,</span> white<span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">block</span><span class=\"typ-punct\">(</span>fill<span class=\"typ-punct\">:</span> color<span class=\"typ-punct\">.</span><span class=\"typ-func\">mix</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">(</span>red<span class=\"typ-punct\">,</span> <span class=\"typ-num\">70%</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">,</span> <span class=\"typ-punct\">(</span>blue<span class=\"typ-punct\">,</span> <span class=\"typ-num\">30%</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/d23013ea064fa345f4d82557526ed8a4.png\" alt=\"Preview\"></div></div>","self":false,"params":[{"name":"colors","details":"<p>The colors, optionally with weights, specified as a pair (array of\nlength two) of color and weight (float or ratio).</p>\n<p>The weights do not need to add to <code><span class=\"typ-num\">100%</span></code>, they are relative to the\nsum of all weights.</p>","example":null,"types":["color","array"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":true,"settable":false},{"name":"space","details":"<p>The color space to mix in. By default, this happens in a perceptual\ncolor space (<a href=\"/en-US-v0.13.1/reference/visualize/color/#definitions-oklab\"><code>oklab</code></a>).</p>","example":null,"types":["any"],"strings":[],"default":"<code>oklab</code>","positional":false,"named":true,"required":false,"variadic":false,"settable":false}],"returns":["color"],"scope":[]},{"path":["color"],"name":"transparentize","title":"Transparentize","keywords":[],"oneliner":"Makes a color more transparent by a given factor.","element":false,"contextual":false,"deprecation":null,"details":"<p>Makes a color more transparent by a given factor.</p>\n<p>This method is relative to the existing alpha value.\nIf the scale is positive, calculates <code>alpha - alpha * scale</code>.\nNegative scales behave like <code>color.opacify(-scale)</code>.</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-func\">#</span><span class=\"typ-func\">block</span><span class=\"typ-punct\">(</span>fill<span class=\"typ-punct\">:</span> red<span class=\"typ-punct\">)</span><span class=\"typ-punct\">[</span>opaque<span class=\"typ-punct\">]</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">block</span><span class=\"typ-punct\">(</span>fill<span class=\"typ-punct\">:</span> red<span class=\"typ-punct\">.</span><span class=\"typ-func\">transparentize</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">50%</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">[</span>half red<span class=\"typ-punct\">]</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">block</span><span class=\"typ-punct\">(</span>fill<span class=\"typ-punct\">:</span> red<span class=\"typ-punct\">.</span><span class=\"typ-func\">transparentize</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">75%</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">[</span>quarter red<span class=\"typ-punct\">]</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/6e735785029f8dce00615699d53ddedf.png\" alt=\"Preview\"></div></div>","self":true,"params":[{"name":"scale","details":"<p>The factor to change the alpha value by.</p>","example":null,"types":["ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["color"],"scope":[]},{"path":["color"],"name":"opacify","title":"Opacify","keywords":[],"oneliner":"Makes a color more opaque by a given scale.","element":false,"contextual":false,"deprecation":null,"details":"<p>Makes a color more opaque by a given scale.</p>\n<p>This method is relative to the existing alpha value.\nIf the scale is positive, calculates <code>alpha + scale - alpha * scale</code>.\nNegative scales behave like <code>color.transparentize(-scale)</code>.</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-key\">#</span><span class=\"typ-key\">let</span> half-red <span class=\"typ-op\">=</span> red<span class=\"typ-punct\">.</span><span class=\"typ-func\">transparentize</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">50%</span><span class=\"typ-punct\">)</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">block</span><span class=\"typ-punct\">(</span>fill<span class=\"typ-punct\">:</span> half-red<span class=\"typ-punct\">.</span><span class=\"typ-func\">opacify</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">100%</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">[</span>opaque<span class=\"typ-punct\">]</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">block</span><span class=\"typ-punct\">(</span>fill<span class=\"typ-punct\">:</span> half-red<span class=\"typ-punct\">.</span><span class=\"typ-func\">opacify</span><span class=\"typ-punct\">(</span><span class=\"typ-num\">50%</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">[</span>three quarters red<span class=\"typ-punct\">]</span>\n<span class=\"typ-func\">#</span><span class=\"typ-func\">block</span><span class=\"typ-punct\">(</span>fill<span class=\"typ-punct\">:</span> half-red<span class=\"typ-punct\">.</span><span class=\"typ-func\">opacify</span><span class=\"typ-punct\">(</span><span class=\"typ-op\">-</span><span class=\"typ-num\">50%</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">)</span><span class=\"typ-punct\">[</span>one quarter red<span class=\"typ-punct\">]</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/d5fabefb63ab2121f583cfddbd406ba0.png\" alt=\"Preview\"></div></div>","self":true,"params":[{"name":"scale","details":"<p>The scale to change the alpha value by.</p>","example":null,"types":["ratio"],"strings":[],"default":null,"positional":true,"named":false,"required":true,"variadic":false,"settable":false}],"returns":["color"],"scope":[]}]}}}