Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Configurable dark mode (color scheme) #460

Merged
merged 15 commits into from
Jun 6, 2022

Conversation

fsbraun
Copy link
Sponsor Member

@fsbraun fsbraun commented May 30, 2022

This PR lets the dark mode css be configured by django CMS settings and as proposed in PR django-cms/django-cms#7329.

It also overrides the dark mode settings of Django's admin styling to allow consistent light mode even with OS preferences set to dark mode.

Dark mode settings of django CMS are communicated through the data-color-scheme attribute of the <html> element. If unset the os sets the color scheme. If set data-color-scheme="light" the color scheme is light independently of the OS settings. Same is true for "dark".

Know issue:

  • The admin backend (typically at /admin) always shows in light mode since the django CMS configuration is not available to the Django admin app by default.

@codecov
Copy link

codecov bot commented May 30, 2022

Codecov Report

Merging #460 (0e527fa) into master (845a736) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #460   +/-   ##
=======================================
  Coverage   36.11%   36.11%           
=======================================
  Files           2        2           
  Lines          36       36           
  Branches        1        1           
=======================================
  Hits           13       13           
  Misses         23       23           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 845a736...0e527fa. Read the comment docs.

@fsbraun fsbraun changed the title Feat/Configurable dark mode (color scheme) Feat: Configurable dark mode (color scheme) May 30, 2022
@fsbraun fsbraun changed the title Feat: Configurable dark mode (color scheme) feat: Configurable dark mode (color scheme) May 30, 2022
Copy link
Member

@vinitkumar vinitkumar left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Copy link
Member

@vinitkumar vinitkumar left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@fsbraun fsbraun merged commit 4d49640 into django-cms:master Jun 6, 2022
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.

None yet

2 participants