theme-color-fields

Create theme-aware color fields for Payload UI with token and custom color helpers.

9|1|Updated Oct 5, 2025
One-click install
npx skills add https://github.com/vitakili/payload-plugins --skill theme-color-fields
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: theme-color-fields
Source: https://github.com/vitakili/payload-plugins/tree/main/packages/theme-management/.claude/skills/theme-color-fields
Command: npx skills add https://github.com/vitakili/payload-plugins --skill theme-color-fields

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Theme color controls for Payload components are often boilerplate-heavy; this skill provides ready-to-use helpers to toggle between theme tokens and custom colors and to render values as CSS-ready strings.

Core Features & Use Cases

  • createColorGroup renders a radio between theme color and custom color, plus a live token select and color picker, storing values like { source: 'theme' | 'custom', themeToken?: string, customColor?: string }.
  • createColorField provides a single, always-custom color field with a visual picker.
  • resolveColorValue front-end utility converts the stored value into a CSS color, e.g., token-based values become var(--token) and custom colors pass through unchanged.
  • Import path: import from @kilivi-dev/payloadcms-theme-management/fields/colorFieldHelpers

Quick Start

Configure a color field in a collection by importing the helpers and render the value with resolveColorValue to apply to a CSS property.

Frequently Asked Questions about theme-color-fields

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add theme-aware color controls to Payload CMS collections?

To add theme-aware color controls to Payload CMS, you can use helper functions to render fields that toggle between theme tokens and custom colors, storing values as structured objects for consistent styling across collections and blocks.

How does resolveColorValue convert stored Payload color tokens into CSS variables?

resolveColorValue converts stored Payload color tokens into CSS variables by mapping token-based selections to var(--token) syntax, while passing custom color strings directly through as valid CSS color values for front-end rendering.

What is the best way to manage custom colors versus theme tokens in Payload UI?

The best way to manage custom colors versus theme tokens in Payload UI is using a color group field that provides a radio toggle, allowing editors to switch between predefined tokens and a custom color picker while storing the selection source.

Can I use these Payload color fields for live previews in the front-end?

Yes, you can use these Payload color fields for live previews by passing the stored field object to the front-end resolution utility, which outputs the exact CSS color value needed to apply styles dynamically.

Do I need external dependencies to implement token-based styling in Payload CMS?

No external dependencies are required to implement token-based styling in Payload CMS, as the helper functions provide a self-contained API to define color groups and resolve token values directly within your project structure.