diff --git a/web/index.html b/web/index.html index 976f36c..ee26cf8 100644 --- a/web/index.html +++ b/web/index.html @@ -9,7 +9,7 @@ - + diff --git a/web/src/utils/Context.ts b/web/src/utils/Context.ts index 657bd80..63ec849 100644 --- a/web/src/utils/Context.ts +++ b/web/src/utils/Context.ts @@ -115,10 +115,27 @@ export const SettingsContext = newRidgeState( onSet: (newState, prevState) => { document.documentElement.classList.toggle("dark", newState.darkTheme); DefaultSetter(SettingsKey, newState, prevState); + updateMetaThemeColor(newState.darkTheme); } } ); +/** + * Updates the meta theme color based on the current theme state. + * Used by Safari to color the compact tab bar on both iOS and MacOS. + */ +const updateMetaThemeColor = (darkTheme: boolean) => { + const color = darkTheme ? '#121315' : '#f4f4f5'; + let metaThemeColor: HTMLMetaElement | null = document.querySelector('meta[name="theme-color"]'); + if (!metaThemeColor) { + metaThemeColor = document.createElement('meta') as HTMLMetaElement; + metaThemeColor.name = "theme-color"; + document.head.appendChild(metaThemeColor); + } + + metaThemeColor.content = color; +}; + export const FilterListContext = newRidgeState( FilterListContextDefaults, {