Skip to content
osmods
PostHog

Chart palettes

Choose the colors your charts use, on an instance that never paid for it.

View upstream
AuthorAnneli Kask
PublishedAug 2026
LicenseMIT
Installs128

Why it exists

The request was the kind anyone makes: let me pick the default color combination for my charts, in settings. Reconnaissance found that PostHog already has color themes, with a model, an API and a settings section, all wrapped in a paygate. Without the paid addon the whole screen is replaced by an upgrade notice.

Removing the lock was one line, legal under MIT, and the wrong move: it is the vendor's monetization line. The interesting finding was that the boundary in their backend is more precise than the one on their screen. Their permission classes charge for creating your own themes; global themes are exempt and a staff user can edit them on any plan, and PostHog's own test suite covers exactly that write on a free organization. The mod writes there and touches no paid flag.

What it does

  • A palette picker in settings, under the vendor's own section
  • Palettes measured for contrast and for red-green color blindness
  • Writes the global theme, so no paid flag is involved
  • Restore puts the original colors back at any time

The spec

These acceptance criteria were written with the person who requested the mod, then locked in as its tests. The mod has to pass them on every new release train before it rides along.

  • Picking a palette repaints the charts, verified by reading pixels and not the database row
  • No paid feature flag is set or bypassed anywhere in the diff
  • Restore returns the instance to the stock palette exactly

mods/chart-palettes/tests/pixels.spec.ts

test("applying a palette repaints the bars", async () => {
  await settings.applyPalette("balanced")
  const bars = await chart.readBarColors()  // sampled from the canvas
expect(bars).toEqual(PALETTES.balanced.slice(0, bars.length))
})