From 4f822414cf5e726ed62613ad0d25043df8cbd6f3 Mon Sep 17 00:00:00 2001 From: Ephraim Atta-Duncan Date: Wed, 11 Dec 2024 15:55:35 +0000 Subject: [PATCH] fix: use khebab case --- apps/web/src/app/embed/css-vars.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/web/src/app/embed/css-vars.ts b/apps/web/src/app/embed/css-vars.ts index bedf46c0e..65bb3174b 100644 --- a/apps/web/src/app/embed/css-vars.ts +++ b/apps/web/src/app/embed/css-vars.ts @@ -1,4 +1,5 @@ import { colord } from 'colord'; +import { toKebabCase } from 'remeda'; import { z } from 'zod'; export const ZCssVarsSchema = z @@ -46,9 +47,7 @@ export const toNativeCssVars = (vars: TCssVarsSchema) => { const color = colord(value); const { h, s, l } = color.toHsl(); - // Convert camelCase to kebab-case (e.g., mutedForeground -> muted-foreground) - const kebabKey = key.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase(); - cssVars[`--${kebabKey}`] = `${h} ${s} ${l}`; + cssVars[`--${toKebabCase(key)}`] = `${h} ${s} ${l}`; } }