|
| 1 | +import { createGlobalTheme } from '@vanilla-extract/css'; |
| 2 | +import { modularScale } from 'polished'; |
| 3 | +import colors from 'tailwindcss/colors'; |
| 4 | + |
| 5 | +const createScale = (ratio: number, base: number) => (steps: number) => |
| 6 | + `${modularScale(steps, base, ratio)}px`; |
| 7 | + |
| 8 | +const spaceScale = createScale(1.4, 4); |
| 9 | +const fontSizeScale = createScale(1.3, 16); |
| 10 | +const lineHeightScale = createScale(1.25, 24); |
| 11 | +const borderRadiusScale = createScale(1.5, 4); |
| 12 | + |
| 13 | +export const vars = createGlobalTheme(':root', { |
| 14 | + space: { |
| 15 | + none: '0', |
| 16 | + '0x': spaceScale(0), |
| 17 | + '1x': spaceScale(1), |
| 18 | + '2x': spaceScale(2), |
| 19 | + '3x': spaceScale(3), |
| 20 | + '4x': spaceScale(4), |
| 21 | + '5x': spaceScale(5), |
| 22 | + '6x': spaceScale(6), |
| 23 | + '7x': spaceScale(7), |
| 24 | + '8x': spaceScale(8), |
| 25 | + }, |
| 26 | + color: { |
| 27 | + white: '#fff', |
| 28 | + |
| 29 | + 'gray-50': colors.coolGray[50], |
| 30 | + 'gray-100': colors.coolGray[100], |
| 31 | + 'gray-200': colors.coolGray[200], |
| 32 | + 'gray-300': colors.coolGray[300], |
| 33 | + 'gray-400': colors.coolGray[400], |
| 34 | + 'gray-500': colors.coolGray[500], |
| 35 | + 'gray-600': colors.coolGray[600], |
| 36 | + 'gray-700': colors.coolGray[700], |
| 37 | + 'gray-800': colors.coolGray[800], |
| 38 | + 'gray-900': colors.coolGray[900], |
| 39 | + |
| 40 | + 'green-50': colors.emerald[50], |
| 41 | + 'green-100': colors.emerald[100], |
| 42 | + 'green-200': colors.emerald[200], |
| 43 | + 'green-300': colors.emerald[300], |
| 44 | + 'green-400': colors.emerald[400], |
| 45 | + 'green-500': colors.emerald[500], |
| 46 | + 'green-600': colors.emerald[600], |
| 47 | + 'green-700': colors.emerald[700], |
| 48 | + 'green-800': colors.emerald[800], |
| 49 | + 'green-900': colors.emerald[900], |
| 50 | + }, |
| 51 | + borderRadius: { |
| 52 | + '0x': borderRadiusScale(0), |
| 53 | + '1x': borderRadiusScale(1), |
| 54 | + '2x': borderRadiusScale(2), |
| 55 | + '3x': borderRadiusScale(3), |
| 56 | + '4x': borderRadiusScale(4), |
| 57 | + '5x': borderRadiusScale(5), |
| 58 | + full: '99999px', |
| 59 | + }, |
| 60 | + fontFamily: { |
| 61 | + body: |
| 62 | + '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"', |
| 63 | + }, |
| 64 | + fontSize: { |
| 65 | + '0x': fontSizeScale(0), |
| 66 | + '1x': fontSizeScale(1), |
| 67 | + '2x': fontSizeScale(2), |
| 68 | + '3x': fontSizeScale(3), |
| 69 | + '4x': fontSizeScale(4), |
| 70 | + '5x': fontSizeScale(5), |
| 71 | + }, |
| 72 | + lineHeight: { |
| 73 | + '0x': lineHeightScale(0), |
| 74 | + '1x': lineHeightScale(1), |
| 75 | + '2x': lineHeightScale(2), |
| 76 | + '3x': lineHeightScale(3), |
| 77 | + '4x': lineHeightScale(4), |
| 78 | + '5x': lineHeightScale(5), |
| 79 | + }, |
| 80 | +}); |
0 commit comments