Chart colors
Colour a dataset, a single bar, or the whole chart: in the config, with a theme or a palette of your own, and behind it with a background.
A colour is decided in this order. A dataset's own backgroundColor and borderColor come first. A dataset with none takes the next colour of the palette you gave, or, without one, of the theme. With neither, the default theme draws blue first, then orange. The background, bkg, is white unless you set it, and the text and the grid turn light when it is dark.
A colour for each dataset
backgroundColor fills the bars and borderColor draws their edge. Any CSS colour string works, including rgba for transparency.

The part of the config that matters
{
"data": {
"datasets": [
{
"backgroundColor": "#0b5d3b"
},
{
"backgroundColor": "rgba(184, 67, 15, 0.35)",
"borderColor": "#b8430f",
"borderWidth": 2
}
]
}
}The full URL
https://chartpng.dev/chart?w=480&h=280&dpr=2&c=%7B%22type%22%3A%22bar%22%2C%22data%22%3A%7B%22labels%22%3A%5B%22W1%22%2C%22W2%22%2C%22W3%22%2C%22W4%22%2C%22W5%22%2C%22W6%22%5D%2C%22datasets%22%3A%5B%7B%22label%22%3A%22Web%22%2C%22data%22%3A%5B24%2C37%2C31%2C45%2C39%2C52%5D%2C%22backgroundColor%22%3A%22%230b5d3b%22%7D%2C%7B%22label%22%3A%22App%22%2C%22data%22%3A%5B12%2C18%2C22%2C21%2C30%2C34%5D%2C%22backgroundColor%22%3A%22rgba(184%2C%2067%2C%2015%2C%200.35)%22%2C%22borderColor%22%3A%22%23b8430f%22%2C%22borderWidth%22%3A2%7D%5D%7D%7DA colour for each bar
A list of colours on one dataset colours its bars, slices or points in order. Use it to mark one bar.

The part of the config that matters
{
"data": {
"datasets": [
{
"backgroundColor": ["#85878c", "#85878c", "#85878c", "#85878c", "#85878c", "#b8430f"]
}
]
}
}The full URL
https://chartpng.dev/chart?w=480&h=280&dpr=2&c=%7B%22type%22%3A%22bar%22%2C%22data%22%3A%7B%22labels%22%3A%5B%22W1%22%2C%22W2%22%2C%22W3%22%2C%22W4%22%2C%22W5%22%2C%22W6%22%5D%2C%22datasets%22%3A%5B%7B%22label%22%3A%22Signups%22%2C%22data%22%3A%5B24%2C37%2C31%2C45%2C39%2C52%5D%2C%22backgroundColor%22%3A%5B%22%2385878c%22%2C%22%2385878c%22%2C%22%2385878c%22%2C%22%2385878c%22%2C%22%2385878c%22%2C%22%23b8430f%22%5D%7D%5D%7D%7DA theme with theme=
theme= picks one of six palettes for datasets that set no colour. The parameter sits beside c; the config can say the same in options.plugins.chartpng.theme.

The part of the config that matters, and the parameter beside it
{
"data": {
"datasets": [
{
"label": "Web"
},
{
"label": "App"
}
]
}
}The full URL
https://chartpng.dev/chart?w=480&h=280&dpr=2&c=%7B%22type%22%3A%22bar%22%2C%22data%22%3A%7B%22labels%22%3A%5B%22W1%22%2C%22W2%22%2C%22W3%22%2C%22W4%22%2C%22W5%22%2C%22W6%22%5D%2C%22datasets%22%3A%5B%7B%22label%22%3A%22Web%22%2C%22data%22%3A%5B24%2C37%2C31%2C45%2C39%2C52%5D%7D%2C%7B%22label%22%3A%22App%22%2C%22data%22%3A%5B12%2C18%2C22%2C21%2C30%2C34%5D%7D%5D%7D%7D&theme=colorblindA palette with palette=
palette= is a list of 1 to 12 hex colours that replaces the theme colours, in order. Write the # as %23 or leave it out.

The part of the config that matters, and the parameter beside it
{
"data": {
"datasets": [
{
"label": "Web"
},
{
"label": "App"
}
]
}
}The full URL
https://chartpng.dev/chart?w=480&h=280&dpr=2&c=%7B%22type%22%3A%22bar%22%2C%22data%22%3A%7B%22labels%22%3A%5B%22W1%22%2C%22W2%22%2C%22W3%22%2C%22W4%22%2C%22W5%22%2C%22W6%22%5D%2C%22datasets%22%3A%5B%7B%22label%22%3A%22Web%22%2C%22data%22%3A%5B24%2C37%2C31%2C45%2C39%2C52%5D%7D%2C%7B%22label%22%3A%22App%22%2C%22data%22%3A%5B12%2C18%2C22%2C21%2C30%2C34%5D%7D%5D%7D%7D&palette=0b3d91,c4502aThe background with bkg=
bkg= is the colour behind the chart, white by default. A dark colour turns the text and the grid light.

The part of the config that matters, and the parameter beside it
{
"data": {
"datasets": [
{
"label": "Web"
},
{
"label": "App"
}
]
}
}The full URL
https://chartpng.dev/chart?w=480&h=280&dpr=2&c=%7B%22type%22%3A%22bar%22%2C%22data%22%3A%7B%22labels%22%3A%5B%22W1%22%2C%22W2%22%2C%22W3%22%2C%22W4%22%2C%22W5%22%2C%22W6%22%5D%2C%22datasets%22%3A%5B%7B%22label%22%3A%22Web%22%2C%22data%22%3A%5B24%2C37%2C31%2C45%2C39%2C52%5D%7D%2C%7B%22label%22%3A%22App%22%2C%22data%22%3A%5B12%2C18%2C22%2C21%2C30%2C34%5D%7D%5D%7D%7D&bkg=%23111215Things to know
- The themes are
default,editorial,mono,colorblind,vivid,ocean. An unknown name is a 400. The docs show each one on a light and a dark background. palettetakes 1 to 12 hex colours,#rgbor#rrggbb. It does not check contrast: that is yours to judge.- In a URL, write
#as%23, because a bare#starts the fragment. That goes forbkgtoo:bkg=%23111215. bkg=transparentgives a PNG with no background, for a page of your own. Email and chat show the image on their own colour, so the email guide covers what to do there.- Both
themeandpalettecan be set in the config instead, asoptions.plugins.chartpng.themeandoptions.plugins.chartpng.palette. If the URL and the config both set one, the config wins. - A
brandunderoptions.plugins.chartpngsets the text, grid and plot-area colours of a chart (text,muted,grid,plot) and a shortmarkin the footer, such as{"text":"example.com","color":"#f5a524"}. It needs hex orrgb()colours. Series colours stay withpalette.fontnames one of IBM Plex Sans (the default), Archivo, Inter or Nunito, for example{"font":"Inter"}; any other family is a 400.
More options
- Chart title and subtitle: A title, a subtitle, where they sit and how big they are.
- Chart legend: Move it to the bottom or the right, hide it, change its markers.
- Chart axes: Minimum and maximum, stacked bars, a horizontal chart, hiding an axis, units.
- Chart image size: Width, height and dpr, and the limits on them.
- Chart gallery: every chart type, with its config and URL.
- API reference: every parameter of
/chart, the limits and the errors.