.cursor/skills/figma-color-tokens/SKILL.md
Analyzes and processes Figma primitive color token JSON exports into Tailwind CSS config and showcase pages. Use when the user provides Figma color token files, mentions primitive colors from Figma, or asks to import a color palette. Handles nested color groups, alpha transparency values, and large token sets (300+).
npx skillsauth add KhoaSuperman/Finmori-ReactNativeWeb figma-color-tokensInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Specialized workflow for importing Figma color variable exports into this project's Tailwind + NativeWind design system.
Figma exports color primitives as .tokens.json (often Style.tokens.json) with nested groups:
{
"Colors": {
"Group Name": {
"step": {
"$type": "color",
"$value": {
"colorSpace": "srgb",
"components": [0.98, 0.12, 0.45],
"alpha": 1,
"hex": "#FA1F73"
}
}
}
}
}
Key extraction rules:
$value.hex for the color value$value.alpha to detect transparency (< 1 means alpha channel)$extensions, colorSpace, and componentsSpacing) at the top level — only process Colors- [ ] Step 1: Analyze token JSON (write temp script)
- [ ] Step 2: Map to Tailwind config
- [ ] Step 3: Create showcase page
- [ ] Step 4: Add to home navigation
- [ ] Step 5: Clean up temp files
Critical: Large token files (>100KB) cannot be read in one pass. Write a temporary Node.js script to parse the JSON.
Create scripts/parse-colors.js:
const fs = require('fs');
const data = JSON.parse(fs.readFileSync('PATH_TO_FILE', 'utf8'));
const colors = data.Colors;
// Count ALL token types to verify totals
function findAllTokens(obj, path) {
path = path || '';
let results = [];
for (const [key, val] of Object.entries(obj)) {
if (key === '$extensions') continue;
const p = path ? path + '/' + key : key;
if (val && typeof val === 'object') {
if (val['$type']) results.push({ path: p, type: val['$type'] });
else results = results.concat(findAllTokens(val, p));
}
}
return results;
}
const all = findAllTokens(data);
const byType = {};
all.forEach(t => { byType[t.type] = (byType[t.type] || 0) + 1; });
console.log('Token counts by type:', byType);
console.log('Total:', all.length);
// Extract color groups
Object.entries(colors).forEach(([group, tokens]) => {
console.log('---', group, '---');
Object.entries(tokens).forEach(([name, token]) => {
const v = token['$value'];
const alpha = v.alpha;
const hex = v.hex;
if (alpha < 1) {
console.log(name + ': rgba (alpha:' + alpha + ')');
} else {
console.log(name + ': ' + hex);
}
});
});
Verification: Compare total token count against the user's expected count. The Figma UI may show a total that includes non-color tokens (spacing, numbers, etc.) in the same collection.
Delete the script after extraction is complete.
File: tailwind.config.js → theme.extend.colors
Placement: Always theme.extend.colors (adds alongside existing semantic tokens, never replaces).
Group naming — convert Figma group names to Tailwind keys:
| Figma group name | Tailwind key | Rule |
|---|---|---|
| Base | base | lowercase |
| Brand | brand | lowercase |
| Gray (light mode) | gray-light | kebab-case, drop parenthetical |
| Gray (dark mode alpha) | gray-dark-alpha | kebab-case, drop parenthetical |
| Blue light | blue-light | kebab-case |
| Orange dark | orange-dark | kebab-case |
| Rosé | rose | ASCII-safe |
Step keys: Use the numeric step directly (25, 50, 100...950). For Base group, use descriptive keys (white, black, transparent).
Alpha colors: Convert to rgba() format:
// Token: alpha = 0.56, hex = #FFFFFF
// Output: "rgba(255, 255, 255, 0.56)"
Structure example:
colors: {
brand: {
25: "#F8FAFF",
50: "#EDF2FF",
// ... 100-900
950: "#161C49",
},
"gray-dark-alpha": {
25: "rgba(255, 255, 255, 0.98)",
// ...
},
// ... existing semantic tokens (fg, focus, etc.) remain untouched
}
Ordering: Place primitive palette entries BEFORE existing semantic token entries (fg, focus, etc.) in the config for readability.
Create src/app/showcase/primitive-colors.tsx.
Data structure — define all groups as a typed array:
type ColorStep = { step: string; hex: string }
type ColorGroup = { name: string; tailwindPrefix: string; steps: ColorStep[] }
const COLOR_PALETTE: ColorGroup[] = [ /* ... */ ] as const
For alpha colors, store the rgba() string as the hex value.
Organize groups into categories for collapsible sections:
const CORE_GROUPS = ["Brand", "Error", "Warning", "Success"]
const GRAY_GROUPS = ["Gray (light mode)", "Gray (dark mode)", "Gray (dark mode alpha)", ...]
// Everything else → Extended Palette
Required sections:
Helper functions needed:
isLightColor(hex) — determines text contrast; must handle both #hex and rgba() formatsCollapsibleSection — toggle visibility for large groups (critical for 300+ tokens)Conventions (same as figma-design-tokens skill):
<Typography> for all textclassName for stylingShowcasePage wrapperstyle={{ backgroundColor: hex }} for the actual color swatchesIn src/app/(tabs)/index.tsx, add to CORE_COMPONENTS:
{
title: "Primitive Colors",
description: "The foundational N-token color palette across M scales that underpins all semantic tokens.",
route: "/showcase/primitive-colors",
},
Delete any temporary scripts created in Step 1.
$type and $value are interpreted as PS variables. Always write Node scripts to files instead of using inline -e evaluation.#FFFFFF hex for all steps with varying alpha. Always check for alpha < 1.$type values.tailwind.config.jssrc/app/showcase/primitive-colors.tsxsrc/app/(tabs)/index.tsxsrc/components/showcase-page.tsxsrc/components/ui-kit/Typography.tsxsrc/app/showcase/colors.tsxdevelopment
Imports Figma design token JSON exports and applies them to the Tailwind CSS config and design system. Use when the user provides Figma token files, mentions design tokens from Figma, or asks to implement a token category (radius, spacing, colors, typography, shadows, etc.).
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.
development
Run, watch, debug, and extend OpenClaw QA testing with qa-lab and qa-channel. Use when Codex needs to execute the repo-backed QA suite, inspect live QA artifacts, debug failing scenarios, add new QA scenarios, or explain the OpenClaw QA workflow. Prefer the live OpenAI lane with regular openai/gpt-5.4 in fast mode; do not use gpt-5.4-pro or gpt-5.4-mini unless the user explicitly overrides that policy.