Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

fix(mobile): support a dynamic mobile browser theme color

Gabe Kangasd1b6b8d75664
diff --git a/web/components/layouts/Main/Main.tsx b/web/components/layouts/Main/Main.tsx
index 076ba399a5..4cbb327110 100644
--- a/web/components/layouts/Main/Main.tsx
+++ b/web/components/layouts/Main/Main.tsx
@@ -95,7 +95,6 @@ export const Main: FC = () => {
<link rel="authorization_endpoint" href="/api/auth/provider/indieauth" />
<meta name="msapplication-TileColor" content="#ffffff" />
<meta name="msapplication-TileImage" content="/img/favicon/ms-icon-144x144.png" />
- <meta name="theme-color" content="#ffffff" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
diff --git a/web/components/theme/Theme.tsx b/web/components/theme/Theme.tsx
index 901d1ff529..a299b7aeea 100644
--- a/web/components/theme/Theme.tsx
+++ b/web/components/theme/Theme.tsx
@@ -1,5 +1,6 @@
/* eslint-disable react/no-danger */
-import { FC } from 'react';
+import Head from 'next/head';
+import { FC, useEffect, useState } from 'react';
import { useRecoilValue } from 'recoil';
import { ClientConfig } from '../../interfaces/client-config.model';
import { clientConfigStateAtom } from '../stores/ClientConfigStore';
@@ -12,16 +13,30 @@ export const Theme: FC = () => {
.filter(variable => !!appearanceVariables[variable])
.map(variable => `--${variable}: ${appearanceVariables[variable]}`);
+ const [themeColor, setThemeColor] = useState('#fff');
+
+ useEffect(() => {
+ const color = getComputedStyle(document.documentElement).getPropertyValue(
+ '--theme-color-background-header',
+ );
+ setThemeColor(color);
+ }, [appearanceVars]);
+
return (
- <style
- dangerouslySetInnerHTML={{
- __html: `
+ <>
+ <Head>
+ <meta name="theme-color" content={themeColor} />
+ </Head>
+ <style
+ dangerouslySetInnerHTML={{
+ __html: `
:root {
${appearanceVars.join(';\n')}
}
${customStyles}
`,
- }}
- />
+ }}
+ />
+ </>
);
};