fix: set os attribute correctly to body (#8225)

* feat: add os constants

* update
This commit is contained in:
Konv Suu 2025-07-17 12:03:21 +08:00 committed by GitHub
parent 04afa61d55
commit 6bdb157af3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,4 @@
import { isMac } from '@renderer/config/constant'
import { isMac, isWin } from '@renderer/config/constant'
import { useSettings } from '@renderer/hooks/useSettings'
import useUserTheme from '@renderer/hooks/useUserTheme'
import { ThemeMode } from '@renderer/types'
@ -40,7 +40,7 @@ export const ThemeProvider: React.FC<ThemeProviderProps> = ({ children }) => {
useEffect(() => {
// Set initial theme and OS attributes on body
document.body.setAttribute('os', isMac ? 'mac' : 'windows')
document.body.setAttribute('os', isMac ? 'mac' : isWin ? 'windows' : 'linux')
document.body.setAttribute('theme-mode', actualTheme)
// if theme is old auto, then set theme to system