-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[5.x] Template color scheme configuration #42221
Conversation
Hey @Fedik , looks good. Do you see also an option to add the user parameters as an extra layer, so a user can define their preferences? |
build/media_source/templates/administrator/atum/js/template.es6.js
Outdated
Show resolved
Hide resolved
I thought about it, but I would make it in separated PR. |
can't we do this in a generic way? maybe with a module and joomla w-c and event trigger and not only for atum? |
Co-authored-by: Brian Teeman <brian@teeman.net>
also you call it color scheme switcher, which leads to the expectation that you can more then on/off dark mode (which by the way would make sense, allowing more then just darkmode on/off) if this things is also useable for the frontend and by 3rd party |
Why not do it the bootstrap way as this is for a bootstrap template? Specifically I am redferring to the javascript so that this can be easily toggled. Currently if i understand this correctly then its a template style setting which will mean its about 5 clicks just to toggle. https://getbootstrap.com/docs/5.3/customize/color-modes/#javascript |
You mean for User specific? Yeah, that can work also, it will be "local setting" and in each browser user should do it again. Also will need to add a Swicth somewhere in to UI. If you mean in general, it already is as generic as possible.
Because in Browser API it called
Let's be honest, how often do you need it? I will set it once and will forget it exists. |
Perhaps but perhaps not |
Suppose it boils down to whether Joomla wants to simply toggle between OS, light and dark, or whether they want to offer a spectrum of themes. I'd even go as far as saying a switcher (toggle) doesn't warrant saving the preference in the database, but instead just via local storage, seeing as it's a quick and easy action. |
I agree with you about using local storage. That is the most logical place to store an environmental setting as opposed to a site setting |
With Firefox dark mode OFF and Dark Mode set to use Dark Theme the Toolbar button text has too little contrast. Otherwise OK. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42221. |
yes, this part is in the description under "SCSS fixes needed" title, |
I don't want to offend anyone, but why should the choice of color scheme be in the template settings? This is fundamentally the wrong approach. Same as taking your browser settings to select a theme. Does the site only have one administrator? No, there may be a lot of them. And some people use the dark theme, and some don't. For example, when working at a computer in good lighting, I do not use dark themes. But in phone I use dark scheme, it’s very difficult for me to look at light scheme on phone. Therefore, if you make different color schemes, then changing the scheme should be available on each page so that a person can change it at any time. Otherwise, it is not much different from what it is now. And once again I apologize if my words or tone offended anyone. |
I totally agree with @Septdir . It is a smart approach. |
I also want a color scheme switch on the admin toolbar |
I have tested this item ✅ successfully on 9209543 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42221. |
@adj9 idem |
The style fix will be there: Current PR povides only the switch feature. |
What a very nice improvement for the dark mode - thanks @fedir for your work 🚀 🤖 and also for the support, collaboration and for testing to @bembelimen @fgsw @brianteeman |
Yes, it probably because of an issue in scss, I wrote in the fitrst comment. |
When installing, it is in light mode. After installing and redirecting to login page, then it is in dark mode. Expected behavior? |
Does your OS use Dark Mode? if yes, then it is expected I guess. |
Yes. |
joomla/joomla-cms#42966 - (только для en-GB) joomla/joomla-cms#42953 + joomla/joomla-cms#42986 + joomla/joomla-cms#42221 + joomla/joomla-cms#41659 + joomla/joomla-cms#43061 + joomla/joomla-cms#43054 - (только для en-GB) joomla/joomla-cms#42995 - (только для en-GB) joomla/joomla-cms#43115 + joomla/joomla-cms#43147 + + Upmerge
Pull Request for Issue #42134 .
Summary of Changes
Add a Color scheme switch to Atum template.
The PR allow to choose prefered color scheme based on OS setting, or fixed.
Instead of using media query (which is not possible to override) it uses data attribute (
data-bs-theme
for bootstrap).Very similar to what @dgrammatiko tried in #42209 .
New API
The following data attributes should be used within template:
data-color-scheme-os
When template should follow OS settingdata-color-scheme="light"
Use Light schemedata-color-scheme="dark"
Use Dark schemeThe combination
data-color-scheme-os data-color-scheme="dark"
means that the template will follow OS setting, but initialy will be useddark
color scheme.Addittionaly the PR introduce a new JavaScript event
joomla:color-scheme-change
which dispatched when color scheme changes.All of this will allow to extensions easily follow to actual template state.
And in theory, should simplify Editor fixes for specified color scheme.
SCSS fixes needed
Following SCSS code does not work:
All such instance should use:
(Or maybe someoen know better fixes?)
After the PR will be merged someone should look on it. Or can send PR against my PR.
Testing Instructions
Apply patch run
npm install
.Check the template Atum parameters
Dark mode
.When its set to
Follow OS settings
then template color scheme should changes when OS color scheme changes.When its set to
Use Light theme
orUse Dark theme
then template color scheme should stay Light or Dark, always.Link to documentations
Please select: