CSS Variables Generator
Generate a complete CSS custom properties system for your design tokens
System Info
e.g., "ds" creates --ds-color-primary
Color Presets
Colors
Spacing
00px
14px
28px
312px
416px
520px
624px
832px
Typography
xsAa10.24px
smAa12.80px
baseAa16.00px
lgAa20.00px
xlAa25.00px
2xlAa31.25px
3xlAa39.06px
4xlAa48.83px
5xlAa61.04px
Output Format
Actions
Generated Code
/* my-design-system - CSS Custom Properties */
/* Generated by CSS Variables Generator */
:root {
/* Colors */
--color-primary: #3b82f6;
--color-secondary: #6366f1;
--color-accent: #f59e0b;
--color-success: #10b981;
--color-warning: #f59e0b;
--color-danger: #ef4444;
--color-info: #0ea5e9;
--color-text: #1f2937;
--color-text-light: #6b7280;
--color-background: #ffffff;
--color-surface: #f9fafb;
--color-border: #e5e7eb;
/* Spacing */
--spacing-0: 0px;
--spacing-1: 4px;
--spacing-2: 8px;
--spacing-3: 12px;
--spacing-4: 16px;
--spacing-5: 20px;
--spacing-6: 24px;
--spacing-8: 32px;
--spacing-10: 40px;
--spacing-12: 48px;
--spacing-16: 64px;
--spacing-20: 80px;
--spacing-24: 96px;
--spacing-32: 128px;
--spacing-40: 160px;
--spacing-48: 192px;
--spacing-64: 256px;
/* Typography */
--font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
--font-family-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
--font-size-xs: 10.24px;
--font-size-sm: 12.80px;
--font-size-base: 16.00px;
--font-size-lg: 20.00px;
--font-size-xl: 25.00px;
--font-size-2xl: 31.25px;
--font-size-3xl: 39.06px;
--font-size-4xl: 48.83px;
--font-size-5xl: 61.04px;
--line-height: 1.5;
--line-height-tight: 1.25;
--line-height-loose: 1.75;
--font-weight-light: 300;
--font-weight-normal: 400;
--font-weight-medium: 500;
--font-weight-semibold: 600;
--font-weight-bold: 700;
/* Border Radius */
--radius-none: 0;
--radius-sm: 0.125rem;
--radius-md: 0.375rem;
--radius-lg: 0.5rem;
--radius-xl: 0.75rem;
--radius-2xl: 1rem;
--radius-full: 9999px;
/* Shadows */
--shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
--shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
/* Z-Index */
--z-dropdown: 1000;
--z-sticky: 1020;
--z-fixed: 1030;
--z-modal-backdrop: 1040;
--z-modal: 1050;
--z-popover: 1060;
--z-tooltip: 1070;
/* Transitions */
--transition-fast: 150ms ease;
--transition-normal: 300ms ease;
--transition-slow: 500ms ease;
/* Breakpoints (for reference) */
--breakpoint-sm: 640px;
--breakpoint-md: 768px;
--breakpoint-lg: 1024px;
--breakpoint-xl: 1280px;
--breakpoint-2xl: 1536px;
}
CSS Variables Best Practices
- Naming Convention: Use semantic names (color-primary) over specific values (color-blue)
- Prefix: Add a prefix to avoid conflicts with other libraries
- Scale System: Use consistent scales for spacing and typography
- Dark Mode: Define variables per theme in separate selectors
- Fallbacks: Use var(--color, fallback) for browser compatibility
- Performance: CSS variables are inherited, place them on :root for global access