From 38f053bb5d584acec839f64b0f7af8f6d6e25935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicole=20Miko=C5=82ajczyk?= Date: Tue, 27 May 2025 00:45:25 +0200 Subject: [PATCH] pl-fe: make themes work with style-src: self csp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicole Mikołajczyk --- packages/pl-fe/src/init/pl-fe-head.tsx | 4 ++-- packages/pl-fe/src/utils/theme.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/pl-fe/src/init/pl-fe-head.tsx b/packages/pl-fe/src/init/pl-fe-head.tsx index 1c710e003..a3c4f5798 100644 --- a/packages/pl-fe/src/init/pl-fe-head.tsx +++ b/packages/pl-fe/src/init/pl-fe-head.tsx @@ -46,10 +46,10 @@ const PlFeHead = () => { 'dark': theme === 'dark', 'dark black': theme === 'black', })} + // @ts-ignore + style={themeCss + ['dark', 'black'].includes(theme) ? 'color-scheme: dark;' : ''} /> - {themeCss && } - {['dark', 'black'].includes(theme) && } ); diff --git a/packages/pl-fe/src/utils/theme.ts b/packages/pl-fe/src/utils/theme.ts index 62210833e..0b810e5e3 100644 --- a/packages/pl-fe/src/utils/theme.ts +++ b/packages/pl-fe/src/utils/theme.ts @@ -76,7 +76,7 @@ const generateNeutral = (brandColor: string): string | null => { return hslToHex({ h, s: 20, l: 55 }); }; -const parseShades = (obj: Record, color: string, shades: Record): void => { +const parseShades = (obj: Record, color: string, shades: Record): void => { if (!shades) return; if (typeof shades === 'string') { @@ -98,7 +98,7 @@ const parseShades = (obj: Record, color: string, shades: Record +const parseColors = (colors: TailwindColorPalette): Record => Object.keys(colors).reduce((obj, color) => { parseShades(obj, color, colors[color] as TailwindColorObject); return obj;