Skip to content

Commit

Permalink
Merge pull request #3539 from lpranam/dark_theme_error
Browse files Browse the repository at this point in the history
match dark theme of system if no nextcloud theme specified
  • Loading branch information
juliushaertl committed Mar 27, 2024
2 parents ccdd7fc + 5826ae4 commit d4a6b85
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/helpers/coolParameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ const getUIDefaults = () => {
const textRuler = 'false'
const sidebar = 'false'
const saveAsMode = 'group'
const uiMode = defaults.UIMode ?? 'notebookbar' // or notebookbar
const uiMode = defaults.UIMode ?? 'notebookbar'

const systemDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
// FIXME For now we need to access parent here as the public page loaded for collabora doesn't have the user theme
const nextcloudDarkMode = parent.document.body.dataset.themeDark === '' || parent.document.body.dataset.themeDarkHighcontrast === ''
const matchedDarkMode = parent.document.body.dataset.themeDefault === '' ? systemDarkMode : nextcloudDarkMode
const dataset = (document.body.dataset.themes ? document.body.dataset : parent?.document.body.dataset) ?? {}
const nextcloudDarkMode = dataset?.themeDark === '' || dataset?.themeDarkHighcontrast === ''
const matchedDarkMode = (!dataset?.themes || dataset?.themes === '' || dataset?.themeDefault === '') ? systemDarkMode : nextcloudDarkMode
const uiTheme = matchedDarkMode ? 'dark' : 'light'

let uiDefaults = 'TextRuler=' + textRuler + ';'
Expand Down

0 comments on commit d4a6b85

Please sign in to comment.