Reference
Presets and reuse¶
Name a style once and use it everywhere.
Quick reference¶
| Utility | Does | Example |
|---|---|---|
preset-<name> |
Expand a built-in or kh.define() style | preset-choroplethpreset-outlinepreset-points |
Built-in presets¶
| Preset | Expands to |
|---|---|
preset-choropleth |
scheme-q5 stroke-1 stroke-white null-gray-300 highlight-amber-400 |
preset-outline |
fill-transparent stroke-2 stroke-slate-700 |
preset-points |
size-4 stroke-1 stroke-white highlight-amber-400 |
preset-topo |
stroke-orange-800/80 width-[weight] width-max-1.6 legend-none |
A preset expands in place. Words you write always override the preset's, wherever they sit in the string: preset-choropleth scheme-e4 uses equal intervals. A preset's scheme also gives way to a categorical ramp you type and to text data, so preset-choropleth fill-[region] ramp-set2 works.
Your own¶
kh.define("brand-choropleth", "fill-[value] ramp-[teal-100,teal-800] scheme-q5 stroke-white stroke-1")
kh.map(gdf, "preset-brand-choropleth")
kh.define checks the style when you define it. Keep your presets, kh.palette ramps and kh.theme themes in one module and import it at the top of each notebook.