简体中文
CSS 变量及其工作原理
AuthProvider
export const MyComponent = () => ( <div className="bg-background text-foreground border rounded-4xl shadow"> <p>我正在使用 CSS 变量!</p> </div> );
@repo/tailwind-config
tailwind
import { tailwind } from '@repo/tailwind-config'; export const MyComponent = () => ( <div style={{ background: tailwind.theme.colors.background, color: tailwind.theme.colors.muted.foreground, }}> <p>我正在直接从 Tailwind 配置中使用样式!</p> </div> );
const variables: Theme['variables'] = { // ... colorBackground: 'hsl(var(--background))', colorPrimary: 'hsl(var(--primary))', colorDanger: 'hsl(var(--destructive))', colorInputBackground: 'hsl(var(--transparent))', colorInputText: 'hsl(var(--text-foreground))', colorNeutral: 'hsl(var(--neutral))', colorShimmer: 'hsl(var(--primary) / 10%)', colorSuccess: 'hsl(var(--success))', colorText: 'hsl(var(--text-foreground))', colorTextOnPrimaryBackground: 'hsl(var(--text-foreground))', colorTextSecondary: 'hsl(var(--text-muted-foreground))', colorWarning: 'hsl(var(--warning))', };