Adds a Color themes collection, a Color theory global and CSS endpoints to Payload. Editors build a theme from a few hex colors using OKLCH-based harmonies, and the plugin generates light and dark CSS variables for the site and optionally the Payload admin. Colors are adjusted to meet WCAG AA, or kept exact with warnings. Requires Payload 3.80 or later, @payloadcms/ui and React 19.
Color Theory for Payload: build site and admin themes from color harmonies (complementary, triadic, tetradic and more), with contrast checked in light and dark, an Auto, Light and Dark switch, and JSON import and export with hex values.
Installation
npm i @extantape/payload-plugin-color-theory0
Stars
0
Forks
0
Open Issues
1 weeks ago
Last Updated
146
Weekly Downloads
v0.1.1
npm Version
87.2 KB
Unpacked Size
0
Dependencies
00 since Nov 8
| Date | Stars |
|---|---|
| Dec 6, 2026 | 0 |
| Dec 5, 2026 | 0 |
| Dec 4, 2026 | 0 |
| Dec 3, 2026 | 0 |
| Dec 2, 2026 | 0 |
| Dec 1, 2026 | 0 |
| Nov 30, 2026 | 0 |
| Nov 29, 2026 | 0 |
| Nov 28, 2026 | 0 |
| Nov 27, 2026 | 0 |
| Nov 26, 2026 | 0 |
| Nov 25, 2026 | 0 |
| Nov 24, 2026 | 0 |
| Nov 23, 2026 | 0 |
| Nov 22, 2026 | 0 |
| Nov 21, 2026 | 0 |
| Nov 20, 2026 | 0 |
| Nov 19, 2026 | 0 |
| Nov 18, 2026 | 0 |
| Nov 17, 2026 | 0 |
| Nov 16, 2026 | 0 |
| Nov 15, 2026 | 0 |
| Nov 14, 2026 | 0 |
| Nov 13, 2026 | 0 |
| Nov 12, 2026 | 0 |
| Nov 11, 2026 | 0 |
| Nov 10, 2026 | 0 |
| Nov 9, 2026 | 0 |
| Nov 8, 2026 | 0 |
146+146 since Nov 11
| Date | Weekly downloads |
|---|---|
| Dec 6, 2026 | 146 |
| Dec 5, 2026 | 185 |
| Dec 4, 2026 | 355 |
| Dec 3, 2026 | 384 |
| Dec 2, 2026 | 411 |
| Dec 1, 2026 | 437 |
| Nov 30, 2026 | 474 |
| Nov 29, 2026 | 554 |
| Nov 28, 2026 | 534 |
| Nov 27, 2026 | 372 |
| Nov 26, 2026 | 345 |
| Nov 25, 2026 | 334 |
| Nov 24, 2026 | 498 |
| Nov 23, 2026 | 462 |
| Nov 22, 2026 | 537 |
| Nov 21, 2026 | 508 |
| Nov 20, 2026 | 493 |
| Nov 19, 2026 | 462 |
| Nov 18, 2026 | 429 |
| Nov 17, 2026 | 205 |
| Nov 16, 2026 | 190 |
| Nov 15, 2026 | 0 |
| Nov 14, 2026 | 298 |
| Nov 13, 2026 | 254 |
| Nov 12, 2026 | 0 |
| Nov 11, 2026 | 0 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1452135444-root)<a href="https://payloaddirectory.dev/plugins/1452135444-root"><img src="https://payloaddirectory.dev/badge/1452135444-root.svg" alt="Payload Directory"></a>README
Color Theory for Payload: build site and admin themes from color harmonies (complementary, triadic, tetradic and more), with contrast checked in light and dark, an Auto, Light and Dark switch, and JSON import and export with hex values.
Status: early, 0.x. 38 tests pass. Tried on a local copy of a real site in Chromium, light and dark:
It hasn't been used on a live site yet. On a local copy of a real site (Chromium, light and dark, desktop and phone), the light/dark switch, Bold brand intensity, the header and its menus passed axe on eight pages. The editor's UI kit and the exact-colors warnings have only been tested in jsdom so far.
Harmonies. From one base color: monochromatic, analogous, complementary, split complementary, triadic, tetradic (rectangle) and square. Hues are rotated in OKLCH, a perceptual color space, so the results look equally light and belong together.
Themes from a few colors. A theme is a name and a handful of hex colors: primary, secondary, accent, a neutral (the color grays lean toward), and optionally success, warning and error.
Tokens for the site. --palette-* variables for light and dark: surfaces, text, borders, and for each role a fill, the text on it, a readable text shade and a soft background.
Payload's admin, too. It gets its own --color-base-*, success, warning and error scales, the variables Payload is themed with, so the admin's own dark mode keeps working. Off until you turn it on.
Readable by construction. Text passes WCAG AA (4.5:1) on every surface it can sit on: the page, cards, sunken areas and its own soft badge background. Fills stand out from the page (3:1). A brand color that doesn't pass is moved in lightness only, keeping its hue. The editor shows every pair with its ratio.
Light, dark and Auto. The CSS follows data-theme="light|dark" on <html>. With no choice saved, it follows the device. @extantape/payload-plugin-color-theory/mode has the pieces a site needs:
colorModeScript(): an inline script for <head>, so the page never flashes the wrong mode. Import it from the main entry or @extantape/payload-plugin-color-theory/mode/script, neither of which is a client module, so a server layout can call it. The /mode entry is a client module and also re-exports it, but a server component can't call it from there;ColorModeProvider and useColorMode(): in Auto, these follow the device live;ColorModeSelector: an Auto / Light / Dark select you can label in any language.The choice is stored under payload-theme, the key Payload's website template uses, so choices people already made carry over.
Brand intensity. One setting for how much of the site carries the brand colors: Off, Subtle, Balanced or Bold (the default). Each level turns on more kinds of element: Subtle colors button fills; Balanced adds the header and badge colors; Bold adds the thin bands on cards and the washes behind page intros. Any kind can be set to always on or always off. The site reads them as tokens (--palette-button, --palette-header, --palette-header-rule, --palette-badge-*, --palette-band, --palette-wash), so it needs no settings code. Every level passes WCAG AA (tested).
Adjust, or keep my exact colors. By default colors are adjusted for accessibility. Switch a theme to "Use my exact colors" and nothing is moved: the editor marks what falls short and offers the nearest passing color, but saving still works.
A live UI kit in the editor. A header, buttons, links, a card with its band, badges, a form field and an alert, in light and dark side by side, updated as you change colors. A red mark sits on any element that fails WCAG AA; open it for "Better for accessibility: #xxxxxx" and a "Use this" button. Under the kit, a live WCAG table (closed by default) gives each pair's ratio, graded AAA, AA, "AA, close" or Fails in color and in words; choosing a row points at that element. The result is announced politely once you pause.
Import and export. Themes are plain JSON with hex values (format: "color-theory/1"). Import checks every field and says what's wrong. The admin refuses to save a theme that wouldn't import.
Presets: Field Guide, Terracotta, Rainforest, Reef, Desert bloom, Night market, High contrast. Each passes contrast in light and dark.
{
"format": "color-theory/1",
"name": "Field Guide",
"colors": { "primary": "#cf8137", "secondary": "#e48185", "accent": "#5a8f6b", "neutral": "#3b2a26" },
"radius": { "md": 8, "lg": 14 }
}
On its own. Color Theory needs only Payload. It adds its own collection, global and CSS endpoints, and your site links the CSS. It doesn't use any other plugin.
Needs. Payload ^3.80.0, @payloadcms/ui ^3.80.0 and React ^19.0.0 as peer dependencies. No other EXTANT APE plugin is required.
Works with:
@extantape/payload-plugin-nested-docs-browser): the browser's --ndb-* variables fall back to the --palette-* tokens Color Theory writes, so it picks up the site's theme with nothing to set. Neither imports the other. Only the token names are shared.@extantape/payload-plugin-polyglot): the language picker and the translation notice fall back to the same --palette-* tokens.applyToAdmin on, any plugin whose admin screens use Payload's --theme-* colors follows your palette there too. Each plugin's README says whether it does.Family. Color Theory is in the Theme family, with Stock Images, which is named but not built yet. The families are a working draft that may change.
npm install @extantape/payload-plugin-color-theory
// payload.config.ts
import { colorTheory } from '@extantape/payload-plugin-color-theory'
plugins: [
colorTheory({
access: ({ req }) => req.user?.role === 'admin', // who may save and choose themes; required
adminGroup: 'Design',
}),
]
This adds:
/api/color-theory/theme.css, /api/color-theory/admin.css and /api/color-theory/presets.The CSS is sent with an ETag and no-cache. A change shows on the next page load, and an unchanged theme costs a 304. Everyone may read themes, because they're only colors.
On the site, link the CSS and add the mode script:
import { colorModeScript } from '@extantape/payload-plugin-color-theory' // server-safe
import { ColorModeProvider, ColorModeSelector } from '@extantape/payload-plugin-color-theory/mode' // client
<html suppressHydrationWarning>
<head>
<script dangerouslySetInnerHTML={{ __html: colorModeScript() }} />
<link rel="stylesheet" href="/api/color-theory/theme.css" />
</head>
<body>
<ColorModeProvider>
<ColorModeSelector />
{children}
</ColorModeProvider>
</body>
</html>
Or render the CSS on the server with activeThemeCss(payload). The selector has the classes ct-mode, ct-mode__label and ct-mode__select, plus data-mode and data-resolved for styling.
npm test # Vitest
npm run typecheck
npm run build
MIT. See LICENSE.
theme
Admin UI theme for Payload v4 with three styles and four palettes in light and dark
74343/wk10v4
theme management
Theme presets, live preview and WCAG audit for editing site appearance from the Payload admin
73130/wk9v3
payload plugin admin theme
Bold or Quiet admin themes in light and dark by swapping Payload's color variables, checked for WCAG AA contrast
350v?
payload theme
shadcn-style redesign of the Payload admin with dashboard, command palette, dark mode and live theme customizer
751.8k/wk36v3
styles
Manage UnoCSS design sets, shortcuts and design tokens from the Payload admin to generate site and admin CSS
6033/wk37v3
payload admin theme
shadcn-style admin theme for Payload configured from a global in the admin panel without rebuilds
5324/wk2v3