Skip to content

Commit 33f877d

Browse files
committed
Fix color types
1 parent 8188c2e commit 33f877d

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/about/SnakeGame.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ const _SnakeGame = css``;
191191

192192
const Board = css`
193193
background: repeating-conic-gradient(
194-
${color("colors-primary-100")} 0 90deg,
194+
${color("colors/primary-100")} 0 90deg,
195195
transparent 0 180deg
196196
)
197197
0 0/32px 32px;

src/style/colorsTs.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@ import theme from "./theme";
33
export const themeColors = theme.colors;
44

55
export const themeColorNameList = (() => {
6-
const list: string[] = [];
6+
const set = new Set<string>();
77

88
for (const colorSet of [themeColors, themeColors.light, themeColors.dark]) {
99
for (const [key, value] of Object.entries(colorSet)) {
10-
if (typeof value == "string") list.push(key);
10+
if (typeof value == "string") set.add(key);
1111
}
1212
}
1313

14-
return list;
14+
return set;
1515
})();
1616

1717
export const themeColorList = (() => {
1818
const list: string[] = [];
1919

2020
for (const colorSet of [themeColors, themeColors.light, themeColors.dark]) {
21-
for (const [key, value] of Object.entries(colorSet)) {
21+
for (const value of Object.values(colorSet)) {
2222
if (typeof value == "string") list.push(value);
2323
}
2424
}

src/style/mixins/layoutTs.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ export const _color = (value: string) => {
3838

3939
const important = rest.some((v) => v == "!important");
4040

41-
if (!themeColorNameList.includes(value)) {
41+
if (!themeColorNameList.has(value)) {
4242
console.warn(`color '${value}' was not found in the current color palette`);
43+
console.log(themeColorNameList);
4344
console.trace();
4445
}
4546

@@ -50,7 +51,7 @@ export const _color = (value: string) => {
5051
type ColorTheme = "light" | "dark";
5152

5253
export const _staticColor = (value: string, theme: ColorTheme) => {
53-
if (!themeColorNameList.includes(value)) {
54+
if (!themeColorNameList.has(value)) {
5455
console.warn(`color '${value}' was not found in the current color palette`);
5556
console.trace();
5657
return;

src/style/tw.style.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ import {
1313
jumboText,
1414
largeText,
1515
primaryFontBold,
16-
smallText,
1716
style,
1817
subText,
1918
textDefinitions,
2019
} from "~/style/commonStyle";
2120
import { pxToRem } from "~/style/fluidSizeTS";
2221

23-
const twColors = themeColorNameList
22+
const twColors = Array.from(themeColorNameList.keys())
2423
.map(normalizeColorName)
2524
.map((color) => `--color-${color}: var(--color-${color});`)
2625
.join("\n");

0 commit comments

Comments
 (0)