PageSourceSearch

https://cetz-package.github.io/docs/assets/js/9c06df48.0af4d397.js

js cetz-package.github.io collected 2026-10-03 08:46:26 UTC 2,662 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkcetz_documentation=self.webpackChunkcetz_documentation||[]).push([[2431],{6619:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>a,metadata:()=>o,toc:()=>c});var i=n(4848),r=n(8453);const a={},s="Palette",o={id:"api/libraries/palette/index",title:"Palette",description:'A palette is a function of the form index => style that takes an index, that can be any int and returns a canvas style dictionary. If passed the string "len" it must return the length of its unique styles. An example use for palette functions is the plot library, which can use palettes to apply different styles per plot.',source:"@site/cetz/docs/api/libraries/palette/index.mdx",sourceDirName:"api/libraries/palette",slug:"/api/libraries/palette/",permalink:"/docs/api/libraries/palette/",draft:!1,unlisted:!1,editUrl:"https://github.com/cetz-package/docs/blob/main/cetz/docs/api/libraries/palette/index.mdx",tags:[],version:"current",frontMatter:{},sidebar:"api",previous:{title:"Tree",permalink:"/docs/api/libraries/tree/tree"},next:{title:"New",permalink:"/docs/api/libraries/palette/new"}},l={},c=[{value:"Predefined Palettes",id:"predefined-palettes",level:2}];function p(e){const t={code:"code",h1:"h1",h2:"h2",header:"header",p:"p",...(0,r.R)(),...e.components},{Type:n}=t;return n||function(e,t){throw new Error("Expected "+(t?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Type",!0),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.header,{children:(0,i.jsx)(t.h1,{id:"palette",children:"Palette"})}),"\n",(0,i.jsxs)(t.p,{children:["A palette is a function of the form ",(0,i.jsx)(t.code,{children:"index => style"})," that takes an index, that can be any ",(0,i.jsx)(n,{children:"int"})," and returns a canvas style dictionary. If passed the string ",(0,i.jsx)(t.code,{children:'"len"'})," it must return the length of its unique styles. An example use for palette functions is the plot library, which can use palettes to apply different styles per plot."]}),"\n",(0,i.jsx)(t.h2,{id:"predefined-palettes",children:"Predefined Palettes"})]})}function d(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(p,{...e})}):p(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>s,x:()=>o});var i=n(6540);const r={},a=i.createContext(r);function s(e){const t=i.useContext(a);return i.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:s(e.components),i.createElement(a.Provider,{value:t},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.