-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3119847
commit 3d51660
Showing
9 changed files
with
125 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,95 @@ | ||
import * as radixColors from '@radix-ui/colors' | ||
import typography from '@tailwindcss/typography' | ||
import type { Config } from 'tailwindcss' | ||
|
||
const colors = {} | ||
|
||
Object.entries(radixColors).forEach(([key, value]) => { | ||
const [baseColor, ...prefixes] = key | ||
.split(/(?=[A-Z])/) | ||
.map((word) => word.toLowerCase()) | ||
colors[baseColor] ??= {} | ||
Object.entries(value).forEach(([colorKey, colorValue]) => { | ||
colors[baseColor][[...prefixes, colorKey.replace(/\D+/, '')].join('-')] = | ||
colorValue | ||
}) | ||
}) | ||
|
||
const brand = 'violet' as const | ||
|
||
const gray = ( | ||
{ | ||
tomato: 'mauve', | ||
red: 'mauve', | ||
crimson: 'mauve', | ||
pink: 'mauve', | ||
plum: 'mauve', | ||
purple: 'mauve', | ||
violet: 'mauve', | ||
|
||
indigo: 'slate', | ||
blue: 'slate', | ||
sky: 'slate', | ||
cyan: 'slate', | ||
|
||
teal: 'sage', | ||
mint: 'sage', | ||
green: 'sage', | ||
|
||
grass: 'olive', | ||
lime: 'olive', | ||
|
||
yellow: 'sand', | ||
amber: 'sand', | ||
orange: 'sand', | ||
brown: 'sand' | ||
} as const | ||
)[brand] | ||
|
||
colors['primary'] = colors[brand] | ||
colors['neutral'] = colors[gray] | ||
colors['white'].DEFAULT = 'white' | ||
colors['black'].DEFAULT = 'black' | ||
|
||
const prose = { | ||
body: '11', | ||
headings: '12', | ||
lead: '11', | ||
links: 'blue.11', | ||
bold: '12', | ||
counters: '11', | ||
bullets: '12', | ||
hr: '6', | ||
quotes: '12', | ||
'quote-borders': '6', | ||
captions: '11', | ||
code: '12', | ||
'pre-code': '12', | ||
'pre-bg': '3', | ||
'th-borders': '7', | ||
'td-borders': '6' | ||
} | ||
|
||
const getProse = (theme: (key: string) => string) => { | ||
const res = {} | ||
Object.keys(prose).forEach((key) => { | ||
const value = `colors.${prose[key].replace(/^\d/, 'gray.$&')}` | ||
res[`--tw-prose-${key}`] = theme(value) | ||
res[`--tw-prose-invert-${key}`] = theme(value.replace(/\d+$/, 'dark-$&')) | ||
}) | ||
return res | ||
} | ||
|
||
export default { | ||
darkMode: 'class', | ||
content: ['./src/**/*.tsx'], | ||
theme: { | ||
extend: { | ||
colors: { brand: '#9EB1FF' } | ||
colors, | ||
extend: { | ||
typography: ({ theme }) => ({ DEFAULT: { css: getProse(theme) } }) | ||
} | ||
} | ||
}, | ||
plugins: [] | ||
plugins: [typography] | ||
} satisfies Config |