Skip to content

Commit e07535e

Browse files
committed
add comment about stringified function
1 parent 61554e7 commit e07535e

File tree

1 file changed

+5
-1
lines changed
  • packages/svelte-ux/src/lib/styles

1 file changed

+5
-1
lines changed

packages/svelte-ux/src/lib/styles/theme.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ export const colorNames = [
2222
];
2323

2424
/** Return a script tag that will set the initial theme from localStorage. This allows setting
25-
* the theme before anything starts rendering, even when SSR is in use. */
25+
* the theme before anything starts rendering, even when SSR is in use.
26+
*
27+
* This feels a bit weird compared to just placing the function directly in svelte:head,
28+
* but it's the only way to inject the `darkThemes` array into the function.
29+
**/
2630
export function createHeadSnippet(darkThemes: string[]) {
2731
function _applyInitialStyle(darkThemes) {
2832
let theme = localStorage.getItem('theme');

0 commit comments

Comments
 (0)