forked from Dogfalo/materialize
-
-
Notifications
You must be signed in to change notification settings - Fork 107
Open
Labels
Description
Before submitting...
- I have searched for duplicate or closed issues.I have read the CONTRIBUTING document and my issue is following the guidelines.I have read the template completely before filling it in.To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
Context
The darkmode is not advanced enough in terms of options
Current Behavior
The dark mode option is perfect but deserves to be deepened
Expected behavior
If possible, the ideal would be to be able to activate it as a component
Here are some interesting leads and cool options like:
- Activation or not via the "materialize.init.js" file like the other components.
- Dark mode with choice between: Dark, Light and Automatic (ex: in a drop-down menu) the automatic would be executed, if selected
by the user instead of darkmode depending on the time of day (example "darkmode" between 19pm and 7am otherwise "lightmode", it's just one more condition but very practical). - Show toast (“Dark”, “Light”, “Automatic” mode “On”, “Off”).
- Switching from darkmode to lightmode with a wave effect as (https://vuetifyjs.com/)
Possible Solutions or Causes
No response
Your Environment
MaterializeCSS : 2.0.1 alpha
Chrome : Version 114.0.5735.134 (Build officiel) (64 bits)
Windows 11 on desktop
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
Jerit3787 commentedon Jun 18, 2023
Hi, I would like to just give my opinions on this one. Actually, I think that this should be the website developer responsibility to implement this, not under the responsibility of maintainer as different websites have their own different needs and implementations. I haven't found a CSS library that do this yet on a library-level of implementations. Plus, it would be a hassle to properly maintain this as it will depends on other's library / browser feature. Would also want to hear from others as well. This is only mere my opinions.
EDIT : I wouldn't say it is impossible but I'm looking at other library approach.
ivanBell199 commentedon Jun 20, 2023
As a random (not advanced) user of the library I can say that I am completely happy with the current implementation. A simple example of JS theme-toggle and a list of CSS variables are fine for me
Kam3leoN commentedon Jul 16, 2023
The idea is to appeal not just to one person but to a wide audience.
I agree with the fact that it is the developer of the site but in the absolute it is finally a component like any other some will use the sidebar others not, hence the idea of making it a component and to give free rein to choice via options. ;)
danice commentedon Jul 16, 2023
I agree with @Jerit3787 , a framework should leave open how to apply the styles.
For example, about this light / dark , it also exist the prefers-color-scheme , I have not used that but it seems a way for the user to fix its preferences from the browser:
prefers-color-scheme is used to detect if a user has requested light or dark color themes. A user indicates their preference through an operating system setting (e.g. light or dark mode) or a user agent setting.
If the framework had implemented what you said (the "automatic" option)it will conflict with this option.
kenny-nt commentedon Jun 27, 2024
I create personal wordpress plugin with materialize and it is default set to dark > make all admin go to dark. How to make default theme to light? I check localstorage and no attribute: theme
Jerit3787 commentedon Jun 27, 2024
Hi @kenny-nt, you can view this issue for solutions #483.
p/s sorry my mistake
for default theme, it seems to react based on theme set on the html element
the usage of
localstorage
is to store user's preference for the theme option and loads up every time users load the website.kenny-nt commentedon Jun 27, 2024
html tag currently do not have attribute theme and it is still dark as default. I tried to edit and add theme="light" > make body to light. Is it should be light as default!?
Jerit3787 commentedon Jun 27, 2024
I'm not sure why your default theme is dark. The default theme for materialize is light, and you should also be able to switch to dark. If you could provide how the implementations on your side would be appreciated.
kenny-nt commentedon Jun 27, 2024
``> > html tag currently do not have attribute theme and it is still dark as default. I tried to edit and add theme="light" > make body to light. Is it should be light as default!?
I just enqueue materialize into an option page of wordpress (wp-admin_ . I dont setup html tag, the default html tag of wordpress admin backend. I checked html tag:
But the page is dark mode... It is not happened with 2.0.4
wuda-io commentedon Jun 27, 2024
The default theme depends now on the system preferences. If you have set your System to dark mode then Materialize will also render in dark. If you have default light mode, then it will render light.
You can override the theme via Javascript. The documentation needs to be updated. And also all the old theme variables are deprecated. We use now directly the M3 vars, because they were already mix up and it was cleaner to use them directly. There is still a lot of work to do, so please contribute. Every support is very welcome! Thanks.