turned template into create cli
This commit is contained in:
18
template/apps/studio/lib/colorUtils.ts
Normal file
18
template/apps/studio/lib/colorUtils.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { brandColors, primitives, variables } from '@repo/ui'
|
||||
|
||||
export const createColorList = () => {
|
||||
// Flatten primitives into a single object
|
||||
const flatPrimitives = Object.entries(primitives).reduce((acc, [category, shades]) => {
|
||||
Object.entries(shades).forEach(([shade, value]) => {
|
||||
acc[`${category}-${shade}`] = value;
|
||||
});
|
||||
return acc;
|
||||
}, {} as Record<string, string>);
|
||||
|
||||
const allColors = { ...flatPrimitives, ...variables, ...brandColors };
|
||||
|
||||
return Object.entries(allColors).map(([key, value]) => ({
|
||||
label: key.replace(/[-_]/g, ' ').replace(/^\w/, c => c.toUpperCase()),
|
||||
value: value as string
|
||||
}));
|
||||
};
|
||||
Reference in New Issue
Block a user