mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
Merge pull request #5276 from sebdanielsson/add-theme-color
fix: Set theme colors to fix white top bar for PWA
This commit is contained in:
@@ -114,6 +114,29 @@
|
||||
document.documentElement.classList.add(e);
|
||||
});
|
||||
|
||||
const metaThemeColor = document.querySelector('meta[name="theme-color"]');
|
||||
if (metaThemeColor) {
|
||||
if (_theme.includes('system')) {
|
||||
const systemTheme = window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
? 'dark'
|
||||
: 'light';
|
||||
console.log('Setting system meta theme color: ' + systemTheme);
|
||||
metaThemeColor.setAttribute('content', systemTheme === 'light' ? '#ffffff' : '#171717');
|
||||
} else {
|
||||
console.log('Setting meta theme color: ' + _theme);
|
||||
metaThemeColor.setAttribute(
|
||||
'content',
|
||||
_theme === 'dark'
|
||||
? '#171717'
|
||||
: _theme === 'oled-dark'
|
||||
? '#000000'
|
||||
: _theme === 'her'
|
||||
? '#983724'
|
||||
: '#ffffff'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
console.log(_theme);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user