Skip to content

Commit

Permalink
refactor(themes): reorder keys
Browse files Browse the repository at this point in the history
  • Loading branch information
kripod committed Dec 11, 2023
1 parent 532af83 commit ac2f867
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function oklchCoords(color: string) {
return color.replace(/^oklch\((.+)\)$/u, "$1");
}

type ColorGroup = "neutral" | "primary";
type ColorGroup = "primary" | "neutral";
type ColorLevel = 0 | 1 | 2 | 3 | 4 | 5;

type ColorFamily<T extends ColorGroup> = {
Expand All @@ -21,33 +21,33 @@ const colorL4 = { light: 700, dark: 300 } as const;
const colorL5 = { light: 800, dark: 200 } as const;

export const lightTheme = {
"--color-neutral-0": oklchCoords(colors.zinc[colorL0.light]),
"--color-neutral-1": oklchCoords(colors.zinc[colorL1.light]),
"--color-neutral-2": oklchCoords(colors.zinc[colorL2.light]),
"--color-neutral-3": oklchCoords(colors.zinc[colorL3.light]),
"--color-neutral-4": oklchCoords(colors.zinc[colorL4.light]),
"--color-neutral-5": oklchCoords(colors.zinc[colorL5.light]),

"--color-primary-0": oklchCoords(colors.blue[colorL0.light]),
"--color-primary-1": oklchCoords(colors.blue[colorL1.light]),
"--color-primary-2": oklchCoords(colors.blue[colorL2.light]),
"--color-primary-3": oklchCoords(colors.blue[colorL3.light]),
"--color-primary-4": oklchCoords(colors.blue[colorL4.light]),
"--color-primary-5": oklchCoords(colors.blue[colorL5.light]),

"--color-neutral-0": oklchCoords(colors.zinc[colorL0.light]),
"--color-neutral-1": oklchCoords(colors.zinc[colorL1.light]),
"--color-neutral-2": oklchCoords(colors.zinc[colorL2.light]),
"--color-neutral-3": oklchCoords(colors.zinc[colorL3.light]),
"--color-neutral-4": oklchCoords(colors.zinc[colorL4.light]),
"--color-neutral-5": oklchCoords(colors.zinc[colorL5.light]),
} as const satisfies Theme;

export const darkTheme = {
"--color-neutral-0": oklchCoords(colors.zinc[colorL0.dark]),
"--color-neutral-1": oklchCoords(colors.zinc[colorL1.dark]),
"--color-neutral-2": oklchCoords(colors.zinc[colorL2.dark]),
"--color-neutral-3": oklchCoords(colors.zinc[colorL3.dark]),
"--color-neutral-4": oklchCoords(colors.zinc[colorL4.dark]),
"--color-neutral-5": oklchCoords(colors.zinc[colorL5.dark]),

"--color-primary-0": oklchCoords(colors.blue[colorL0.dark]),
"--color-primary-1": oklchCoords(colors.blue[colorL1.dark]),
"--color-primary-2": oklchCoords(colors.blue[colorL2.dark]),
"--color-primary-3": oklchCoords(colors.blue[colorL3.dark]),
"--color-primary-4": oklchCoords(colors.blue[colorL4.dark]),
"--color-primary-5": oklchCoords(colors.blue[colorL5.dark]),

"--color-neutral-0": oklchCoords(colors.zinc[colorL0.dark]),
"--color-neutral-1": oklchCoords(colors.zinc[colorL1.dark]),
"--color-neutral-2": oklchCoords(colors.zinc[colorL2.dark]),
"--color-neutral-3": oklchCoords(colors.zinc[colorL3.dark]),
"--color-neutral-4": oklchCoords(colors.zinc[colorL4.dark]),
"--color-neutral-5": oklchCoords(colors.zinc[colorL5.dark]),
} as const satisfies Theme;

0 comments on commit ac2f867

Please sign in to comment.