AgentSkillsCN

Ds Tokens

设计Token速查手册——涵盖颜色、间距、字体、阴影等各项要素。

SKILL.md
--- frontmatter
skill: ds-tokens
description: Quick reference for design tokens - colors, spacing, typography, shadows, and more
triggers:
  - "design tokens"
  - "token reference"
  - "ds tokens"
  - "color tokens"
  - "spacing tokens"
  - "what token for"

Design Tokens Quick Reference

Complete reference for all design system tokens. Use semantic tokens instead of hardcoded values.

Color Tokens

Semantic Surface Tokens

TokenLight ModeDark ModeUsage
bg-backgroundWhiteSlate 900Page background
bg-foregroundSlate 900Slate 50Inverted backgrounds
bg-cardWhiteSlate 800Card backgrounds
bg-popoverWhiteSlate 800Popover/dropdown backgrounds
bg-mutedSlate 100Slate 700Subtle backgrounds
bg-accentSlate 100Slate 700Accent backgrounds

Text Tokens

TokenLight ModeDark ModeUsage
text-foregroundSlate 900Slate 50Primary text
text-muted-foregroundSlate 500Slate 400Secondary text
text-card-foregroundSlate 900Slate 50Card text
text-popover-foregroundSlate 900Slate 50Popover text
text-accent-foregroundSlate 900Slate 50Accent text

Interactive Tokens

TokenLight ModeDark ModeUsage
bg-primaryBlue 500Blue 400Primary buttons
text-primaryBlue 500Blue 400Primary links
text-primary-foregroundWhiteSlate 900Text on primary bg
bg-secondarySlate 100Slate 700Secondary buttons
text-secondary-foregroundSlate 900Slate 50Text on secondary bg
bg-destructiveRed 500Red 600Danger buttons
text-destructiveRed 500Red 400Error text

Border & Ring Tokens

TokenLight ModeDark ModeUsage
border-borderSlate 200Slate 700Default borders
border-inputSlate 200Slate 700Input borders
ring-ringBlue 500Blue 400Focus rings

CSS Custom Properties

css
/* Use in CSS when needed */
hsl(var(--background))
hsl(var(--foreground))
hsl(var(--primary))
hsl(var(--primary-foreground))
hsl(var(--secondary))
hsl(var(--secondary-foreground))
hsl(var(--muted))
hsl(var(--muted-foreground))
hsl(var(--accent))
hsl(var(--accent-foreground))
hsl(var(--destructive))
hsl(var(--destructive-foreground))
hsl(var(--border))
hsl(var(--input))
hsl(var(--ring))

Spacing Tokens

Based on 4px base unit:

TokenValueUsage
00pxReset
14pxTight spacing
28pxIcon gaps
312pxSmall gaps
416pxDefault padding
520pxMedium padding
624pxCard padding
832pxSection spacing
1040pxLarge gaps
1248pxSection margins
1664pxPage sections
2080pxHero spacing
2496pxLarge sections

Usage

typescript
// Padding
className="p-4"     // 16px all sides
className="px-6"    // 24px left/right
className="py-2"    // 8px top/bottom

// Margin
className="mb-8"    // 32px bottom
className="mt-16"   // 64px top
className="mx-auto" // center horizontally

// Gap (flexbox/grid)
className="gap-4"   // 16px gap
className="gap-x-6" // 24px horizontal
className="gap-y-2" // 8px vertical

Typography Tokens

Font Sizes

TokenSizeLine HeightUsage
text-xs12px16pxLabels, captions
text-sm14px20pxSmall text, descriptions
text-base16px24pxBody text (default)
text-lg18px28pxLead paragraphs
text-xl20px28pxH4 headings
text-2xl24px32pxH3 headings
text-3xl30px36pxH2 headings
text-4xl36px40pxH1 headings
text-5xl48px1Hero headings

Font Weights

TokenWeightUsage
font-normal400Body text
font-medium500Labels, emphasis
font-semibold600Subheadings
font-bold700Headings

Usage

typescript
// Heading
className="text-3xl font-semibold"

// Body
className="text-base font-normal"

// Label
className="text-sm font-medium"

// Caption
className="text-xs text-muted-foreground"

Shadow Tokens

TokenUsage
shadow-smSubtle elevation
shadowDefault cards
shadow-mdElevated cards
shadow-lgDropdowns, popovers
shadow-xlModals
shadow-2xlHero elements

Border Radius Tokens

TokenValueUsage
rounded-sm2pxSubtle rounding
rounded4pxDefault (buttons, inputs)
rounded-md6pxCards
rounded-lg8pxLarge cards
rounded-xl12pxContainers
rounded-full9999pxPills, avatars

Usage

typescript
// Button
className="rounded"

// Card
className="rounded-lg"

// Badge/pill
className="rounded-full"

// Avatar
className="rounded-full"

Z-Index Tokens

TokenValueUsage
z-00Base
z-1010Interactive elements
z-2020Sticky elements
z-3030Tooltips, popovers
z-4040Modal backdrop
z-5050Modal content

Breakpoints

TokenMin-widthUsage
sm:640pxLandscape phones
md:768pxTablets
lg:1024pxDesktops
xl:1280pxLarge desktops
2xl:1536pxVery large screens

Usage

typescript
// Mobile-first responsive
className="text-sm md:text-base lg:text-lg"
className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
className="px-4 md:px-6 lg:px-8"

Animation Tokens

Durations

TokenValueUsage
duration-7575msMicro-interactions
duration-100100msFast feedback
duration-150150msMost transitions
duration-200200msDefault
duration-300300msState changes
duration-500500msPage transitions

Easing

typescript
// Ease out (most common)
className="transition-all duration-150 ease-out"

// Ease in-out
className="transition-colors duration-200 ease-in-out"

Quick Lookup Table

NeedToken
Page backgroundbg-background
Card backgroundbg-card
Primary buttonbg-primary text-primary-foreground
Secondary buttonbg-secondary text-secondary-foreground
Danger buttonbg-destructive text-destructive-foreground
Body texttext-foreground
Secondary texttext-muted-foreground
Default borderborder-border
Focus ringring-ring
Standard paddingp-4
Card paddingp-6
Section marginmb-8 or mb-16
Default roundedrounded
Card roundedrounded-lg
Default shadowshadow-md