Developers · Gutenberg
Color Tokens block for WordPress
Design-system colour token reference. Displays named colour swatches grouped into palettes (Primary, Neutral, Semantic, etc.) with hex/RGB values. Visitors can click any swatch to copy its hex code.
Get Blockenberg
Free Gutenberg block in Blockenberg. The inspector controls and front-end behavior on this page come from this block’s source, not a shared stub.
What it actually does
Design-system colour token reference. Displays named colour swatches grouped into palettes (Primary, Neutral, Semantic, etc.) with hex/RGB values. Visitors can click any swatch to copy its hex code.
Inspector panels on this block: Content, Swatch Size, Palette Groups (' + a.groups.length +, Spacing & Style. Those titles come from index.js, not from a shared template.
Where to find it
Gutenberg inserter → Developers → search “Color Tokens” (block name `blockenberg/color-tokens` in block.json). Style it in the sidebar after insert.
How to use Color Tokens block for WordPress
- Install Blockenberg. Install from WordPress.org and activate the plugin.
- Insert the block. Edit a page, click +, search for “Color Tokens”, insert it. Category: Developers.
- Configure inspector controls that exist on this block. Open Content. Set “Content — Title”, “Show title”, “Subtitle”, “Show subtitle”.
- Check the published page. The view script reads HTML data attributes: data-ct-ready, data-hex. The block editor preview may not run the same view script.
Inspector controls from this block’s code
| Control | What the code does |
|---|---|
| Content — Title | Text field in the inspector. block.json default: Color System. Saved as `title`. |
| Show title | On/off toggle in the inspector. On by default. Saved as `showTitle`. |
| Subtitle | Text field in the inspector. block.json default: Our full design-system colour palette with token names and hex values. Saved as `subtitle`. |
| Show subtitle | On/off toggle in the inspector. On by default. Saved as `showSubtitle`. |
| Show swatch name | On/off toggle in the inspector. On by default. Saved as `showName`. |
| Show hex value | On/off toggle in the inspector. On by default. Saved as `showHex`. |
| Show RGB value | On/off toggle in the inspector. Off by default. Saved as `showRGB`. |
| Show copy icon on hover | On/off toggle in the inspector. On by default. Saved as `showCopyHint`. |
| Swatch size (px) | Numeric range control in the inspector. Range 40–160. block.json default: 80. Saved as `swatchSize`. |
| Swatch radius (px) | Numeric range control in the inspector. Range 0–24. block.json default: 10. Saved as `swatchRadius`. |
| Group name | Text field in the inspector. Saved as `groups`. |
| Border radius | Numeric range control in the inspector. Range 0–32. block.json default: 16. Saved as `borderRadius`. |
| Padding top | Numeric range control in the inspector. Range 0–120. block.json default: 48. Saved as `paddingTop`. |
| Padding bottom | Numeric range control in the inspector. Range 0–120. block.json default: 48. Saved as `paddingBottom`. |
| Typography — Title | Shared Blockenberg typography popover (family, size, weight, spacing). Saved as `typoTitle`. |
| Subtitle (Typo Subtitle) | Shared Blockenberg typography popover (family, size, weight, spacing). Saved as `typoSubtitle`. |
| Label | Shared Blockenberg typography popover (family, size, weight, spacing). Saved as `typoLabel`. |
| Colors — Background | Color control in the inspector. block.json default: #ffffff. Saved as `bgColor`. |
| Colors — Title | Color control in the inspector. block.json default: #0f172a. Saved as `titleColor`. |
| Subtitle | Color control in the inspector. block.json default: #64748b. Saved as `subtitleColor`. |
| Group name | Color control in the inspector. block.json default: #374151. Saved as `groupNameColor`. |
| Swatch name | Color control in the inspector. block.json default: #374151. Saved as `swatchNameColor`. |
| Swatch meta | Color control in the inspector. block.json default: #6b7280. Saved as `swatchMetaColor`. |
| Swatch card BG | Color control in the inspector. block.json default: #f8fafc. Saved as `swatchBg`. |
| Swatch border | Color control in the inspector. block.json default: #e2e8f0. Saved as `borderColor`. |
What the front-end script actually does
- The view script reads HTML data attributes: data-ct-ready, data-hex.
When this is the right block
- Design-system colour token reference. Displays named colour swatches grouped into palettes (Primary, Neutral, Semantic, etc.) with hex/RGB values. Visitors can click any swatch to copy its hex code — that is the job of Color Tokens, not a generic content block.
- Use it when you need the editor control labeled “Content — Title”, which exists on this block’s inspector.
- It matches pages about color, colour, tokens.
- Inserter grouping: docs sites, utilities, and developer landing pages.
Notes from the implementation
viewScript: this folder’s frontend.js is enqueued on the front end for this block.
FAQ
How do I add the Color Tokens block in WordPress?
Install Blockenberg from WordPress.org, edit a page in the block editor, click +, and search for “Color Tokens”. It sits under Developers. After insert, open Content and set “Content — Title”, “Show title”, “Subtitle”, “Show subtitle”.
What makes Color Tokens different from other Blockenberg blocks?
Design-system colour token reference. Displays named colour swatches grouped into palettes (Primary, Neutral, Semantic, etc.) with hex/RGB values. Visitors can click any swatch to copy its hex code. Inspector labels on this block include “Content — Title”, “Show title”, “Subtitle”, “Show subtitle”.
Is the Color Tokens Gutenberg block free?
Yes. Color Tokens ships inside Blockenberg. Get the plugin from WordPress.org — no paid add-on is required for this block.
Can I style Color Tokens to match my theme?
Yes. Blockenberg’s shared typography and color panels apply here, plus any block-specific style controls listed on this page (panels: Content, Swatch Size, Palette Groups (' + a.groups.length +, Spacing & Style).
Related developers blocks
Color Palette
Display brand color swatches with HEX, RGB, and CSS variable labels. Perfect for style guides and design systems.
Color Harmony
Pick a base color and instantly see complementary, triadic, analogous, and other harmonic palettes. Click any swatch to copy its hex value.
Color Mixer
Interactive color mixing tool. Pick two colors, blend them at any ratio, view the result in HEX/RGB/HSL, generate color harmonies, and copy any value instantly.
Color Thief
Upload an image to automatically extract its dominant color palette using canvas pixel analysis.
Color Converter
Live Hex ↔ RGB ↔ HSL color converter with a real-time color preview swatch.
Contrast Checker
WCAG color contrast accessibility checker. Test foreground/background color combinations against AA and AAA standards.
Get Blockenberg
Install Blockenberg from WordPress.org, then insert Color Tokens from the Gutenberg inserter.