Skip to content

Detect if device is in dark mode or not#17672

Open
diadal wants to merge 2 commits intoquasarframework:devfrom
diadal:dev
Open

Detect if device is in dark mode or not#17672
diadal wants to merge 2 commits intoquasarframework:devfrom
diadal:dev

Conversation

@diadal
Copy link
Contributor

@diadal diadal commented Dec 2, 2024

What kind of change does this PR introduce?

  • Bugfix
  • [* ] Feature
  • Documentation
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes
  • [ *] No

The PR fulfills these requirements:

  • [dev ] It's submitted to the dev branch (or v[X] branch)
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix: #xxx[,#xxx], where "xxx" is the issue number)
  • It's been tested on a Cordova (iOS, Android) app
  • It's been tested on an Electron app
  • Any necessary documentation has been added or updated in the docs or explained in the PR's description.

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to start a new feature discussion first and wait for approval before working on it)

Other information:

this helps to know if the device is in dark mode or not


if (__QUASAR_SSR_SERVER__) {
this.isActive = dark === true
this.isPreferred = matchMedia.matches
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding @rstoenescu's comment from here:
https://github.com/quasarframework/quasar/pull/17670/changes#r1865970342

There is no matchMedia here, nor can it be. This code runs on the server. It should be defaulted to a value (probably false) and updated only on client takeover, otherwise there will be hydration errors.

@yusufkandemir yusufkandemir mentioned this pull request Mar 3, 2026
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants