Tailwind CSS & shadcn/ui
DESIGN.md를 생성된 CSS 토큰과 함께 사용하면 에이전트는 올바른 시맨틱 클래스를 선택하고 브라우저는 렌더링 시점에 정확한 값을 강제할 수 있습니다. DesignMD Pro는 스타일시트 출력을 위해 세 가지 순수 클라이언트 사이드 생성기를 제공합니다.
Tailwind CSS v4 (@theme)
**Tailwind v4 Theme Generator**를 열고 임의의 DESIGN.md를 붙여 넣습니다. 생성기는 frontmatter 토큰 맵을 읽어 globals.css에 바로 사용할 수 있는 CSS를 출력합니다:
DESIGN.md 토큰 그룹 | 출력되는 CSS |
|---|---|
colors.<key> | @theme 내부의 --color-<key>: <hex>; |
colors.light.<key> | @theme 내부의 --color-<key>: <hex>; (기본 테마) |
colors.dark.<key> | .dark 내부의 --color-<key>: <hex>; |
typography 패밀리 | --font-sans (첫 번째 패밀리), --font-sans-2, … |
typography 스케일 | --text-<key> 및 --text-<key>--line-height |
rounded.<key> | --radius-<key>: <dim>; |
spacing.<key> | --spacing-<key>: <dim>; |
출력 예시:
@theme {
--color-primary: #4338ca;
--color-background: #ffffff;
--color-surface: #f6f5f4;
--color-text: #18181b;
--font-sans: "Inter", sans-serif;
--text-body-md: 16px;
--text-body-md--line-height: 1.6;
--radius-md: 8px;
--spacing-md: 16px;
}
.dark {
--color-primary: #818cf8;
--color-background: #0f172a;
}일반 CSS 변수
**CSS Variables Generator**는 프레임워크에 종속되지 않는 :root 및 .dark custom properties를 출력합니다:
colors.<key>→--<key>: <hex>;(colors.dark.*는.dark에 배치)typography.<key>→--font-<key>,--font-<key>-size,--font-<key>-weight,--font-<key>-line-heightrounded.<key>→--radius-<key>spacing.<key>→--spacing-<key>
shadcn/ui 시맨틱 매핑
**shadcn Theme Generator**는 시맨틱 키 매칭(순서대로 평가하며 변수당 첫 번째 일치 항목이 적용됨)을 사용해 DESIGN.md 색상 키를 shadcn의 표준 CSS 변수에 매핑합니다:
| 토큰 키 패턴 | shadcn CSS 변수 |
|---|---|
background, canvas, page, bg | --background |
surface, card, popover, elevated | --card |
primary, brand | --primary |
on-primary, onprimary, primary-foreground | --primary-foreground |
secondary | --secondary |
muted, subtle, disabled | --muted |
accent, tertiary | --accent |
destructive, error, danger | --destructive |
border, outline, divider, stroke | --border |
ring, focus | --ring |
text, foreground, fg, heading, body | --foreground |
| 일치하지 않는 기타 키 | --color-<key> |
모서리 반경의 경우 생성기는 rounded.md(없으면 rounded.base 또는 rounded.default로 폴백)를 --radius에 매핑합니다. 중첩된 colors.dark.* 키도 .dark 내부에서 동일한 시맨틱 매핑을 거칩니다.
Tip
키 이름을 background, surface, primary, on-primary, text, muted, border로 지정하면(완전한 예제 참조) 별도 설정 없이도 shadcn 테마 매퍼와 WCAG 대비 검증기가 모두 바로 동작합니다.
다음 단계
Last updated on