Skip to content

Styling data

Fill and opacity

The inside colour of polygons and points: one colour, or a colour from your data.

Quick reference

Utility Does Example
fill-<colour>
fill-[<expr>]
Constant fill colour, or colour by data fill-indigo-600
fill-indigo-600/70
fill-white
opacity-<0-100> Whole-layer opacity opacity-80
opacity-0
opacity-100
null-<colour> Colour for missing values (default gray-300) null-gray-300
null-zinc-200/60
highlight-<colour> Colour of the feature under the mouse highlight-amber-400
highlight-amber-400/80

One colour

kh.map(states, "basemap-paper fill-teal-600/60 stroke-white stroke-1")

Any colour from the palette, with /opacity, or a hex colour in brackets:

kh.map(states, "basemap-paper fill-[#0f766e]/70 stroke-[#134e4a] stroke-1")

Colour by data

Put a column, a ratio or a scaled column in brackets. See Classification for ramps and schemes.

kh.map(states, "basemap-paper fill-[density] ramp-ylorrd scheme-q5 stroke-white",
       legend={"title": "People per km2"})

Missing values

Rows with no value, a division by zero or an infinity are drawn in null-gray-300 and counted as "No data" in the legend. Change the colour with null-zinc-200/60.

Hover colour

highlight-amber-400 colours the feature under the mouse.

Whole-layer opacity

opacity-80 fades the whole layer, outlines included. To fade only the fill, put the opacity on the colour: fill-teal-600/60.