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.0] Allow OS color scheme override #42209
Conversation
Signed-off-by: Dimitris Grammatikogiannis <dg@dgrammatiko.dev>
Why 2 binary switches? Why not one ternary option?
|
Not a particular reason, I can change the code to that. A minor thing is that BS supports more than dark/light themes so limiting the options and also making the addition of new themes harder might not be the best option (future wise). |
Let’s see if more opinions drop in regarding what’s better from a user point of view. Other question: Shall we close the issue as we have a PR, or shall we leave it open until the ToDo is done? |
Signed-off-by: Dimitris Grammatikogiannis <dg@dgrammatiko.dev>
Meh, keep it open so people have a place to express their legitimate concerns 😀 |
Co-authored-by: Richard Fath <richard67@users.noreply.github.com>
Co-authored-by: Richard Fath <richard67@users.noreply.github.com>
will this not be dependent on the changes in #42010 |
No, as I wrote I didn't do any SCSS changes here, I'm just passing the State to the HTML Element so it will not conflict with the other PR |
The description of this PR should be adapted to the change to one tristate (list) parameter. |
We're going to need two different compilations of the css file to support this and bundle that (plus admin template overrides in potentially two places and code to support that if you're setting bonus CSS vars - which presumably would be part of this - but missing). I really don't see the need. More people have moaned about this because they don't like the design which should be fixed in the other PR than because they actually want a dark mode browser with a bright site. I think we should focus efforts on making the styling of dark mode better than the all black thing I did (obviously I'm not the worlds best designer) than adding extra options and overhead. |
Nope, check the link in the description, there is only one cas file! |
why don't we go the bootstrap why? btw. I wouldn't separated front and backend, we already have to many switchs. |
The difference is that the state is saved in the DB which (for the logged in users) doesn't need writing in the users HD (local storage as cookies are data written in the disk). The JS switch could save the state to either: local storage, session storage, indexDB, cookie which only session storage is on the RAM (so the other require permission).
Can do |
// Getting user accessibility settings | ||
$user = $app->getIdentity(); | ||
$userScheme = $user->getParam('admin_prefers_color_scheme', '0'); | ||
$forcedSchemeAtr = $forcedScheme ? 'data-forced-theme ' : ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does $forcedScheme
come from? Can it be the logic here needs a change after the change to tristate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think the above line 53 just needs to be removed. Same for the other PHP files of course.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It supposed to be forcedSchemeAtr = '';
--link-color: ' . $linkColor . '; | ||
--link-color-rgb: ' . $r . ',' . $g . ',' . $b . '; | ||
--template-special-color: ' . $this->params->get('special-color', '#001B4C') . '; | ||
}'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the "code style" change here should be reverted. It's in the inline CSS not the PHP code, so I think the tabs are ok, also for consistency with the other template PHP files.
I like the switch, but I think we should not create our own wheel again and just using what we already have in Joomla. Also only one attribute is needed but we have to change this parameter to e.g. "data" (or something else and fix the broken and wrongly added definitions). You can test this by adding data-bs-theme="dark|light" attribute to the html tag in joomla backend. So please don't add another dark/light mode layer on top of the existing one. |
It's just a DB value for a given key, people/devs could use it or not. Ie if I want to roll out something that is not requiring permissions (due to EU law about asking before writing to users HD) then such a value is the only way (also it doesn't require JS, not tightly coupled to Bootstrap, etc). Anyways I'm closing as it's not worthy our time |
This is your personal thinking. Facts are different. |
Actually it’s based off the direct feedback that we had in mattermost from a dozen people during the betas and RCs. What’s your facts based on? |
Some billions of people 😅 Only a small bunch of people. It's not good ignoring what large public in the world are using. |
Pull Request for Issue #42134 .
Summary of Changes
data-forced-theme
and adata-theme="light|dark"
TODO:
Create a new _root.scss so that the theme follows the states of the above HTML element states. (ie like: https://github.com/dgrammatiko/muta/blob/b675f730671e3dcf43e2c1331c6f7d80fcc6cb2c/media_source/templates/administrator/muta/scss/_root.scss#L1-L3)
Testing Instructions
Check that in the Atum template the HTML element reflects the state of the User settings
Actual result BEFORE applying this Pull Request
Atum Template is always set to the OS Color Scheme
Expected result AFTER applying this Pull Request
Atum Template can override the OS Color Scheme
Link to documentations
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed