Problem/Motivation
When using UI Skins module, we have access to the global theme settings (dark/light).
Currently some overrides are done that did not respect this value:
- Navbar (page.html.twig)
- Maintenance page navbar (maintenance.html.twig)
- Layout builder
- Media library (media--media-library.html.twig) + add media list
- Mark (mark.html.twig)
Would be great to allow this to work.
Proposed resolution
Add a global theme variable in all templates with ui_suite_bootstrap_preprocess().
Get theme setting for layout builder and media library.
For mark, because it's a reverse style, probably better to change to success.
Remaining tasks
Seems we could achieve something for CKeditor, but this need to add a ckeditor5-stylesheets in the main theme.
Here is the CKeditor documentation on variables for a dark theme.
Issue fork ui_suite_bootstrap-3499985
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mogtofu33 commentedComment #4
grimreaperThanks a lot for the feature request and the MR.
I will give a look and test.
Comment #5
grimreaperComment #6
pdureau commentedCan we move...
The declaration in some YAML files?
in order to be authorable by front developers.
For example, naive proposal in ui_suite_bootstrap.ui_skins.themes:
This proposal is just a first draft, let's think about a better way of doing that
The Bootstrap::getThemeMapping() logic in UI Skins?
We can keep the apply in the ui_suite_bootstrap PHP code for now, so those function will call the new UI Skins API:
Comment #7
pdureau commentedComment #8
grimreaperUI Skins issue created #3500562: Theme definition: link to utility classes.
I will isolate generic stuff unrelated to theme selection in another MR to merge it right now.
Comment #11
grimreaperMerged what was independent from UI Skins.
First MR rebased, so it is clearer what needs to be made generic.
Postponing until UI Skins issue is done.
Comment #12
grimreaperComment #14
mogtofu33 commentedSeems like just removing the specific light classes is enough for the dark theme support!
Comment #15
grimreaperComment #17
grimreaperComment #18
grimreaperFound missing spots.
JS:
- assets/js/text/text.js
- assets/js/misc/tabledrag.js
Some btn-outline-dark, so I think the theme class should be made available in a drupalSettings.
src/Utility/Element.php:
src/HookHandler/PreprocessMenuLocalAction.php:
On PHP side, maybe for both, but at least for PreprocessMenuLocalAction, the problem is that it is the opposite that needs to be gathered. When in dark mode, we need outline-light.
So, more complex than a simple mode/class pair only.
Comment #19
grimreaperNeed to wait for UI Styles 2 (/UI Skins 2), the theme settings will be changed.