Skip to content

Conversation

@evnchn
Copy link
Collaborator

@evnchn evnchn commented Nov 21, 2025

Motivation

There are 2 problems this PR want to address:

  1. Tell browser when dark mode is enabled #5471, where select browsers and Dark Reader extension do not cope well with NiceGUI's dark mode because we did not use <meta> tags to inform them
  2. ui.dark_mode is hard-coded to use Quasar.Dark.set which gets in the way of using other UI frameworks than Quasar (Let configure UI framework other than Quasar #4859)

Real motivation: to experiment, since I have doubts over "demo is good enough instead of API addition" #5471 (comment)

Implementation

  • Quasar.Dark.set will never be called directly: It will be wrapped to take true/false/undefined, then set as darkSetter
  • darkSetter can be another UI library's dark mode function, if you need that.
  • setDark calls the darkSetter while also handles the <meta> tags for you.
  • To prevent FOUC, the <meta> tags are also populated in HTML.

Progress

  • I chose a meaningful title that completes the sentence: "If applied, this PR will..."
  • The implementation is complete.
  • Pytests are not necessary? (not sure...)
  • Documentation is not necessary? (not sure...)
  • Maybe let's use more unique id names to avoid collision with user's code?

@evnchn evnchn added the feature Type/scope: New feature or enhancement label Nov 21, 2025
@falkoschindler falkoschindler added the review Status: PR is open and needs review label Nov 24, 2025
@falkoschindler falkoschindler self-requested a review November 24, 2025 10:39
@falkoschindler falkoschindler added this to the 3.5 milestone Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Type/scope: New feature or enhancement review Status: PR is open and needs review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants