10000 feat: Configurable dark mode by fsbraun · Pull Request #7329 · django-cms/django-cms · GitHub
[go: up one dir, main page]

Skip to content

feat: Configurable dark mode #7329

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

Merged
merged 30 commits into from
Jun 6, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
592a2b6
Fix: toolbar bug 3.10.rc1
fsbraun Feb 9, 2022
7778c29
Merge branch 'django-cms:develop' into develop
fsbraun Feb 11, 2022
96f89cd
Feat: Dark mode support, including input from @marksweb, bugfix for t…
fsbraun Feb 18, 2022
f92fe75
Upstream change to be able to merge
fsbraun Feb 18, 2022
ffee65a
Merge branch 'develop' of github.com:fsbraun/django-cms into develop
fsbraun Feb 18, 2022
ecb9fab
Feat: Dark mode support, including input from @marksweb, bugfix for t…
fsbraun Feb 18, 2022
76876a0
Merge branch 'develop' of github.com:fsbraun/django-cms into develop
fsbraun Feb 18, 2022
a0995e3
Revert "Fix: toolbar bug 3.10.rc1& 8000 quot;
fsbraun Feb 18, 2022
4ec8a5b
Fix: Recommit toolbar fix (??)
fsbraun Feb 18, 2022
e1158f8
Fix: After lint failure: Remove spaces added by PyCharm
fsbraun Feb 18, 2022
1e725f8
Merge branch 'develop' into develop
vinitkumar Mar 5, 2022
4d95141
Fix: Wizzard button color
fsbraun Mar 5, 2022
1fdf757
Merge branch 'develop' of github.com:fsbraun/django-cms into develop
fsbraun Mar 5, 2022
4b0c0be
Merge branch 'develop' into develop
fsbraun Mar 12, 2022
872699a
Merge branch 'django-cms:develop' into develop
fsbraun Mar 22, 2022
281c355
Fix: Correct toolbar according to cms_path
fsbraun Mar 23, 2022
587cdb0
Merge branch 'django-cms:develop' into develop
fsbraun Mar 28, 2022
b67b53e
TASK: use isort to sort imports
crydotsnake Mar 29, 2022
9b8e9cb
Add: Color scheme configurable
fsbraun May 28, 2022
3c124c6
Add: Toolbar toggle (always on)
fsbraun May 28, 2022
656e0c6
Add: CMS_COLOR_SCHEME_TOGGLE setting
fsbraun May 29, 2022
092d6fd
Try fixing test
fsbraun May 29, 2022
f7c4d8f
Add: Basic documentation of new settings
fsbraun May 29, 2022
fb822a3
Merge branch 'develop' into featuire/dark-mode
May 30, 2022
2489871
Fix: unused imports, isort issue
fsbraun May 30, 2022
1857a63
Update CHANGELOG.rst
fsbraun May 30, 2022
b79c569
Fix: color scheme switch as css variables
fsbraun May 30, 2022
5952d77
Fix: Cascade settings into iframes of iframes (e.g., cms plugins ins…
fsbraun May 31, 2022
9093afb
Fix: no toggle in collapsed toolbar
fsbraun May 31, 2022
a2ff041
Merge branch 'develop' into featuire/dark-mode
Jun 6, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add: Basic documentation of new settings
  • Loading branch information
fsbraun committed May 29, 2022
commit f7c4d8f49e22eb3e0afad2d4fe5cd6e8f6daedf7
1 change: 0 additions & 1 deletion cms/utils/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def wrapper():
DEFAULTS = {
'TEMPLATE_INHERITANCE': True,
'DEFAULT_X_FRAME_OPTIONS': constants.X_FRAME_OPTIONS_INHERIT,
'TOOLBAR_SIMPLE_STRUCTURE_MODE': True,
'PLACEHOLDER_CONF': {},
'PERMISSION': False,
# Whether to use raw ID lookups for users when PERMISSION is True
Expand Down
37 changes: 19 additions & 18 deletions docs/reference/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,25 @@ Example::
This setting adds to the default links of the support menu allowing project or company support links.


CMS_COLOR_SCHEME
================

default
``"light"``

Sets the color scheme for django CMS' editing system. Valid values are ``"light"``,
``"dark"``, and ``"auto"``. ``"auto"`` will take the user's preference from
the browser or operating system setting (or light if no preference is available).

CMS_COLOR_SCHEME_TOGGLE
=======================

default
``False``

If set to ``True`` the toolbar will show a moon or sun icon allowing the user
to change the current color scheme from light to dark and vice versa.

CMS_TOOLBAR_ANONYMOUS_ON
========================

Expand Down Expand Up @@ -1086,24 +1105,6 @@ This should be an integer preferably taken from the ``cms.constants`` e.g.
- X_FRAME_OPTIONS_DENY


.. _CMS_TOOLBAR_SIMPLE_STRUCTURE_MODE:

CMS_TOOLBAR_SIMPLE_STRUCTURE_MODE
=================================

default:
``True``

The new structure board operates by default in "simple" mode. The older mode used absolute
positioning. Setting this attribute to ``False`` will allow the absolute positioning used in
versions prior to 3.2. This setting will be removed in 3.3.


Example::

CMS_TOOLBAR_SIMPLE_STRUCTURE_MODE = False


.. setting:: CMS_PAGE_WIZARD_DEFAULT_TEMPLATE

CMS_PAGE_WIZARD_DEFAULT_TEMPLATE
Expand Down
63 changes: 63 additions & 0 deletions docs/topics/colorscheme.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
.. _colorscheme:

##########################################
Color schemes (light/dark) with django CMS
##########################################

.. important::

These notes about the color scheme apply only to the **django CMS admin and editing
interfaces**. The visitor-facing published site is **wholly independent** of this, and the
responsibility of the site developer.

The admin interfaces will only reflect the described behavior if the package
``djangocms-admin-style`` is installed (version XXX or later). If it is not installed the admin
interface is managed by your underlying Django installation which usually
uses the browser's color scheme.

************************
Setting the color scheme
************************

Django CMS' default color scheme is ``"light"``. To change the color scheme use the ``CMS_COLOR_SCHEME``
setting in your project's ``setting.py``:

``CMS_COLOR_SCHEME = "light"``
This is the default appearance and shows the interface with dark text on white background.

``CMS_COLOR_SCHEME = "dark"``
This so-called dark mode show light text on dark background.

``CMS_COLOR_SCHEME = "auto"``
The auto mode chooses either light or dark color scheme based on the browser or
operating system setting of the user.

.. hint::

If you plan to fix the color scheme to either light or dark, add a corresponding
``data-color-scheme`` attribute to the ``html`` tag in your base template, e.g.

.. code-block::

<html data-color-scheme="light">

This will pin the color scheme early when loading pages and avoid potential
flickering if the browser preference differs from the ``CMS_COLOR_SCHEME``
setting.


.. important::

Not all plugin admin interfaces might support a dark color scheme, especially
if plugin forms contain custom widgets. See XXXX on how to make your widgets
compatible with django CMS' color scheme support.

**********************************
Toggle button for the color scheme
**********************************

Adding the setting ``CMS_COLOR_SCHEME_TOGGLE = True`` to the project's ``settings.py``
will add a toggle icon (sun/moon) to the toolbar allowing a user to switch their
color scheme for their session.


935D
1 change: 1 addition & 0 deletions docs/topics/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ concerned with explaining *how to do things* than with helping you understand
i18n
permissions
touch
colorscheme
menu_system
commonly_used_plugins
searchdocs
Expand Down
0