Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions apps/v4/registry/base-colors.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { describe, expect, it } from "vitest"

import { BASE_COLORS } from "./base-colors"

describe("BASE_COLORS", () => {
it("includes the full neutral Tailwind base color set used by create", () => {
expect(BASE_COLORS.map((color) => color.name)).toEqual(
expect.arrayContaining([
"slate",
"gray",
"neutral",
"stone",
"zinc",
"mauve",
"olive",
"mist",
"taupe",
])
)
})
})
36 changes: 31 additions & 5 deletions apps/v4/registry/base-colors.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,35 @@
import gray from "@/public/r/colors/gray.json"
import slate from "@/public/r/colors/slate.json"
import { THEMES } from "@/registry/themes"

export const BASE_COLORS = THEMES.filter((theme) =>
["neutral", "stone", "zinc", "mauve", "olive", "mist", "taupe"].includes(
theme.name
)
)
const MISSING_BASE_COLORS = [
{
name: "slate",
title: "Slate",
cssVars: slate.cssVars,
},
{
name: "gray",
title: "Gray",
cssVars: gray.cssVars,
},
] as const

const EXISTING_BASE_COLOR_NAMES = [
"neutral",
"stone",
"zinc",
"mauve",
"olive",
"mist",
"taupe",
] as const

export const BASE_COLORS = [
...MISSING_BASE_COLORS,
...THEMES.filter((theme) =>
(EXISTING_BASE_COLOR_NAMES as readonly string[]).includes(theme.name)
),
]

export type BaseColor = (typeof BASE_COLORS)[number]