From 13b02c39a050d89bd784d3b2e8a623d4b271317a Mon Sep 17 00:00:00 2001 From: regalijan <r@regalijan.com> Date: Thu, 19 Oct 2023 16:50:23 -0400 Subject: [PATCH] Simplify theme setting in root --- app/root.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/root.tsx b/app/root.tsx index 9704d3e..b69de47 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -165,14 +165,18 @@ function getMarkup( return ( <html + data-theme={loaderData.theme} lang="en-US" - {...(loaderData.theme && { - "data-theme": loaderData.theme, - style: { colorScheme: loaderData.theme }, - })} > <head> <Links /> + <style nonce={loaderData.nonce}> + {` + :root { + color-scheme: ${loaderData.theme}; + } + `} + </style> {serverStyleData?.map(({ key, ids, css }) => ( <style key={key}