shadcn-theming

Customize the Shadcn design system (Tailwind v4 supported). Update design tokens, safe refactoring, and color management.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "shadcn-theming" with this command: npx skills add wiztral/agent-skills/wiztral-agent-skills-shadcn-theming

Shadcn Theming

Use this skill to modify the look and feel of the application (globals.css / index.css), add new colors, and manage design tokens.

Documentation

Workflow

1. File Identification & Validation

  • Locate CSS: app/globals.css (Next.js) or src/index.css (Vite).
    • If missing: Ask user for the main global stylesheet location.
  • Check Version: Look for tailwind.config.js (v3) or @import "tailwindcss"; / @theme { ... } (v4).
    • If both missing: The project might not be set up correctly. Use shadcn-setup or verify Tailwind installation.

2. Token Management & Evolution

Adding New Colors (OKLCH Preferred)

  1. Generate Value: Use the convert_colors.js script to get the OKLCH value for your color.
    node scripts/convert_colors.js "#ff0000"
    
  2. Add to CSS:
    • v4: Add to @theme or @layer base.
    • v3: Add to :root and .dark variables, then reference in tailwind.config.js extend.

Adaptive Design Strategy

When the user asks for high-level changes (e.g., "Make it softer"):

  • Radius: Increase --radius (e.g., 0.5rem -> 1rem).
  • Colors: Lower contrast or saturation using OKLCH chroma (C) values.
  • Density: Adjust spacing tokens if present.

Safe Refactoring

Evolution over Destruction:

  • Do not reuse a semantic token for a significantly different purpose (e.g., don't turn destructive blue).
  • Create New: If a new semantic meaning emerges (e.g., "Success State"), create --success / --success-foreground.
  • Search First: Before renaming --primary, search the entire codebase to understand impact.

3. Contrast & Accessibility

  • Check Pairs: When changing a background color (e.g., --primary), IMMEDIATELY check its pair (--primary-foreground) for contrast.
  • Rule: Ensure at least 4.5:1 contrast ratio for text.

4. Implementation Details (Tailwind v4)

In Tailwind v4, prefer CSS-first configuration:

@theme {
  --color-primary: oklch(0.6 0.1 240);
  --color-primary-foreground: oklch(0.98 0 0);
  /* ... */
}

If the project uses :root variables (standard Shadcn), keep them:

@layer base {
  :root {
    --primary: 0.6 0.1 240; /* Note: Shadcn often uses space-separated values for HSL/legacy. Adapt as needed. */
  }
}

Note: If Shadcn is set up with CSS variables, respect the project's existing format (HSL vs OKLCH).

References

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

skill-creator

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

shadcn-create-project

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

shadcn-setup

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

vercel-composition-patterns

React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.

Repository Source
86.4K23Kvercel