aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/WindowControlsOverlayColor.tsx
blob: 14eda5660326c9314a3512d7cfeb49dca7400c42 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { useTheme } from '@mui/material/styles';
import { useEffect } from 'react';

export default function WindowControlsOverlayColor(): null {
  const {
    palette: {
      outer: { background },
    },
  } = useTheme();
  useEffect(() => {
    document.head
      .querySelectorAll('meta[name="theme-color"]')
      .forEach((meta) => meta.remove());
    const meta = document.createElement('meta');
    meta.name = 'theme-color';
    meta.content = background;
    document.head.appendChild(meta);
  }, [background]);

  return null;
}