-
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
Showing
2 changed files
with
157 additions
and
186 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,57 @@ | ||
type Theme = 'light' | 'dark' | ||
|
||
const theme: Theme = window.matchMedia('(prefers-color-scheme: dark)').matches | ||
? 'dark' | ||
: 'light' | ||
|
||
const rawColors = { | ||
neutral100: { light: '#09090B', dark: '#F4F4F5' }, | ||
neutral80: { light: '#09090BCC', dark: '#F4F4F5CC' }, | ||
neutral60: { light: '#09090B99', dark: '#F4F4F566' }, | ||
neutral20: { light: '#09090B33', dark: '#F4F4F533' }, | ||
neutral20Adjusted: { light: '#09090B1A', dark: '#F4F4F533' }, | ||
neutral10: { light: '#09090B1A', dark: '#F4F4F51A' }, | ||
neutral10Adjusted: { light: '#09090B0D', dark: '#F4F4F51A' }, | ||
neutral10Background: { light: '#F4F4F5', dark: '#F4F4F51A' }, | ||
neutral5: { light: '#09090B0D', dark: '#F4F4F50D' }, | ||
neutralInverted100: { light: '#F4F4F5', dark: '#09090B' }, | ||
neutralInverted80: { light: '#F4F4F5', dark: '#09090BCC' }, | ||
neutralInverted60: { light: '#F4F4F566', dark: '#09090B99' }, | ||
neutralInverted20: { light: '#F4F4F533', dark: '#09090B33' }, | ||
neutralInverted10: { light: '#F4F4F533', dark: '#09090B1A' }, | ||
neutralInverted5: { light: '#F4F4F51A', dark: '#09090B0D' }, | ||
red100: { light: '#ED3131', dark: '#EF4444' }, | ||
red80: { light: '#ED3131CC', dark: '#EF4444CC' }, | ||
red60: { light: '#ED313199', dark: '#EF444499' }, | ||
red20: { light: '#ED313133', dark: '#EF444433' }, | ||
red10: { light: '#ED31311A', dark: '#EF44441A' }, | ||
red5: { light: '#ED31310D', dark: '#EF44440D' }, | ||
amber100: { light: '#EB980A', dark: '#F59E0B' }, | ||
amber80: { light: '#EB980ACC', dark: '#F59E0BCC' }, | ||
amber60: { light: '#EB980A99', dark: '#F59E0B99' }, | ||
amber20: { light: '#EB980A33', dark: '#F59E0B33' }, | ||
amber10: { light: '#EB980A1A', dark: '#F59E0B1A' }, | ||
amber5: { light: '#EB980A0D', dark: '#F59E0B0D' }, | ||
indigo100: { light: '6366F1#', dark: '#7C7EF4' }, | ||
indigo80: { light: '#6366F1CC', dark: '#7C7EF4CC' }, | ||
indigo60: { light: '#6366F199', dark: '#7C7EF499' }, | ||
indigo20: { light: '#6366F133', dark: '#7C7EF433' }, | ||
indigo10: { light: '#6366F11A', dark: '#7C7EF41A' }, | ||
indigo5: { light: '#6366F10D', dark: '#7C7EF40D' }, | ||
green100: { light: '#0FA976', dark: '#10B981' }, | ||
green80: { light: '#0FA976CC', dark: '#10B981CC' }, | ||
green60: { light: '#0FA97699', dark: '#10B98199' }, | ||
green20: { light: '#0FA97633', dark: '#10B98133' }, | ||
green10: { light: '#0FA9761A', dark: '#10B9811A' }, | ||
green5: { light: '#0FA9760D', dark: '#10B9810D' }, | ||
white100: { light: '#F4F4F5', dark: '#F4F4F5' }, | ||
white80: { light: '#F4F4F5CC', dark: '#F4F4F5CC' }, | ||
white60: { light: '#F4F4F599', dark: '#F4F4F599' }, | ||
white20: { light: '#F4F4F533', dark: '#F4F4F533' }, | ||
white10: { light: '#F4F4F51A', dark: '#F4F4F51A' }, | ||
white5: { light: '#F4F4F50D', dark: '#F4F4F50D' }, | ||
black100: { light: '#09090B', dark: '#09090B' }, | ||
black80: { light: '#09090BCC', dark: '#09090BCC' }, | ||
black60: { light: '#09090B99', dark: '#09090B99' }, | ||
black20: { light: '#09090B33', dark: '#09090B33' }, | ||
black10: { light: '#09090B1A', dark: '#09090B1A' }, | ||
black5: { light: '#09090B0D', dark: '#09090B0D' }, | ||
const colors = { | ||
neutral100: 'var(--neutral-100)', | ||
neutral80: 'var(--neutral-80)', | ||
neutral60: 'var(--neutral-60)', | ||
neutral20: 'var(--neutral-20)', | ||
neutral20Adjusted: 'var(--neutral-20-adjusted)', | ||
neutral10: 'var(--neutral-10)', | ||
neutral10Adjusted: 'var(--neutral-10-adjusted)', | ||
neutral10Background: 'var(--neutral-10-background)', | ||
neutral5: 'var(--neutral-5)', | ||
neutralInverted100: 'var(--neutral-inverted-100)', | ||
neutralInverted80: 'var(--neutral-inverted-80)', | ||
neutralInverted60: 'var(--neutral-inverted-60)', | ||
neutralInverted20: 'var(--neutral-inverted-20)', | ||
neutralInverted10: 'var(--neutral-inverted-10)', | ||
neutralInverted5: 'var(--neutral-inverted-5)', | ||
red100: 'var(--red-100)', | ||
red80: 'var(--red-80)', | ||
red60: 'var(--red-60)', | ||
red20: 'var(--red-20)', | ||
red10: 'var(--red-10)', | ||
red5: 'var(--red-5)', | ||
amber100: 'var(--amber-100)', | ||
amber80: 'var(--amber-80)', | ||
amber60: 'var(--amber-60)', | ||
amber20: 'var(--amber-20)', | ||
amber10: 'var(--amber-10)', | ||
amber5: 'var(--amber-5)', | ||
indigo100: 'var(--indigo-100)', | ||
indigo80: 'var(--indigo-80)', | ||
indigo60: 'var(--indigo-60)', | ||
indigo20: 'var(--indigo-20)', | ||
indigo10: 'var(--indigo-10)', | ||
indigo5: 'var(--indigo-5)', | ||
green100: 'var(--green-100)', | ||
green80: 'var(--green-80)', | ||
green60: 'var(--green-60)', | ||
green20: 'var(--green-20)', | ||
green10: 'var(--green-10)', | ||
green5: 'var(--green-5)', | ||
white100: 'var(--white-100)', | ||
white80: 'var(--white-80)', | ||
white60: 'var(--white-60)', | ||
white20: 'var(--white-20)', | ||
white10: 'var(--white-10)', | ||
white5: 'var(--white-5)', | ||
black100: 'var(--black-100)', | ||
black80: 'var(--black-80)', | ||
black60: 'var(--black-60)', | ||
black20: 'var(--black-20)', | ||
black10: 'var(--black-10)', | ||
black5: 'var(--black-5)', | ||
} | ||
|
||
type Color = keyof typeof rawColors | ||
|
||
const colors = new Proxy(rawColors, { | ||
get: (target, prop) => { | ||
if (!(prop in target)) { | ||
throw new Error('invalid color') | ||
} | ||
|
||
return target[prop as keyof typeof target][theme] | ||
}, | ||
set: () => false, | ||
}) as unknown as Record<keyof typeof rawColors, string> | ||
type Color = keyof typeof colors | ||
|
||
export { colors, Color } |