Search by

ernestdefoe / livery

ernestdefoe

Colors for every Flarum tag: generate a palette for all of them at once, readable text on every color, and dark-mode colors, with a preview and undo.

Package info

github.com/ernestdefoe/livery

Language:TypeScript

Type:flarum-extension

pkg:composer/ernestdefoe/livery

Fund package maintenance!

Buy Me A Coffee

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-11-28 17:06 UTC

This package is auto-updated.

Last update: 2026-11-29 15:45:08 UTC


README

Colors for every Flarum tag, readable in light and dark.

Pick a starting color and a scheme, and Livery colors every tag at once: you see each tag before and after, in light and dark mode, before anything is saved, and the change can be undone. Each tag also gets readable text, its own dark-mode color if you want one, and a lock.

Administration → Livery: the palette controls beside a preview of every tag, now, in light mode and in dark mode

What it does

  • Color every tag at once. Start from your forum's primary or secondary color, Bespoke's brand color, or any color you pick. Choose a scheme: Spread (the most distinct colors, however many tags you have), Analogous, Complementary, Triadic, One hue or Random. Shuffle until you like it.
  • Child tags shaded from their parent, so a category and its subtags read as a family.
  • Preview before you save. Every tag as it is now, and as it will be in light and dark mode, with the text contrast of each label.
  • Undo. Apply is one change, and the last five changes can be undone, newest first.
  • Lock a tag to keep its colors when you recolor the rest.
  • Readable text on every tag. Flarum picks black or white text with a quick brightness formula that leaves text too faint on many mid-tone colors: on #e74c3c red it picks white at 3.8:1, under the 4.5:1 that readable text needs. Livery picks by real contrast (WCAG), so every label reads. A tag can also have its own text color.
  • Dark mode colors. Leave tags as they are in dark mode (Flarum's default), let Livery soften each one so it sits well on a dark page, or give a tag a dark color of its own. The Tags page: dark text where Flarum would put white text that's hard to read

Dark mode with Adjust automatically: each tag keeps its hue, softened for a dark page

  • In the Edit Tag dialog: Random, Light and Dark color buttons, the text and dark-mode choices, the lock, and a live preview on a light and a dark page, with an Adjust the color button when the text is hard to read.

The Edit Tag dialog with Livery's fields under Flarum's Color field

Settings

Administration → Livery:

Setting Default
Tag colors in dark mode Same as light Adjust automatically softens every tag for dark pages. A tag can choose for itself.
Readable tag text On Picks text by contrast. Turn it off to keep Flarum's own pick.

Works with everything that draws a tag

Livery doesn't restyle tags itself. It gives every tag its dark-mode color through the tag's own color, so Flarum's labels, tiles and heroes, and other extensions and themes that use a tag's color (Bespoke, Concourse, Postcards, Colored…), all follow it without knowing Livery is there. Text colors go into one small stylesheet, only for tags whose text needs changing, and only for tags the visitor has already loaded.

For themes and extensions

  • --tag-text is set on [data-tag-vars="<slug>"] for every colored tag Livery has drawn: the readable text color for the tag's current background. Use color: var(--tag-text, <your own>) on anything you fill with a tag's color.
  • [data-livery="<slug>"] marks a tag's hero, a discussion's hero and the tag's New Discussion button.
  • The tag resource carries liveryColorDark (#rrggbb, auto, same or null for the forum default), liveryTextColor and liveryTextColorDark (#rrggbb or null for automatic), and liveryLocked for admins.

Good to know

  • Flarum's own Color field stays the source of truth for light mode. Remove Livery and every tag keeps its colors.
  • Every color is checked to be a six-digit hex color before it is saved, since colors end up in a stylesheet.
  • Light. The forum gets under 3 KB of JavaScript (gzipped) and no CSS file. Livery's values for every tag on a page come in one small query, however many tags there are.
  • Requires Flarum 2, flarum/tags and PHP 8.3.

Moving from Tags Color Generator

Livery succeeds Tags Color Generator by Nearata, which brought random tag colors to Flarum 1. Thank you, Nearata. It stored only Flarum's own tag color, so there is nothing to migrate:

composer remove nearata/flarum-ext-tags-color-generator
composer require ernestdefoe/livery
php flarum migrate
php flarum cache:clear

Installation

composer require ernestdefoe/livery
php flarum migrate
php flarum cache:clear

Then enable Livery in the admin panel.

Updating

composer update ernestdefoe/livery
php flarum migrate
php flarum cache:clear

Support

Questions and bug reports: ernestdefoe.online.

☕ If you like the things I have built, consider buying me a coffee.

Licence

MIT.