-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
M3 styles #409
M3 styles #409
Conversation
Yes this is awesome! I also had this in mind, so thanks for making progress. |
Hey, thanks for the heavy lifting, @danice! I would have multiple comments here, also to @wuda-io:
It could be, that I used improper variables for defining font OR background color. Or I forgot to set dynamic color for the font there at all. But this should be fixed, I think. |
I agree, we are just using existing materializecss variables and assigning them to the m3 variables, and I think we should continue this way, with maybe some minor adjustments in the variables.
This is also happening in current website, just that is less visible. The problem is that this rule
is overwritting the
and then --font-color-main variable is applied instead of --font-on-primary-color-main that will be the correct one. I will try to prepare a fix for that. |
@danice thanks for the response. Regarding "existing materializecss variables", fair, you are right, I misunderstood the changes.
We expose global styles (selectors), which depend on md variables. I guess those files come from m3, but these selectors are not part of materializecss spec, I think. And they can conflict. I would suggest removing those files and including only the files with variables.
👍 Probably I overlooked it when I refactored the variables. Thanks! PS could you remove the commented out code, please? |
You are right in that this files
So I don't think is much interesting. On the other side
for display-medium, display-small, and same for headline, body, label and title. We can comment if this could add value to the existing Typography styles, but that could be a separated discussion / task. |
BTW @bugy , checking the style definition for navbar, the M3 background color for the active element is not primary color, but md.sys.color.secondary-container. So I propose adding this variable to _theme_variables and this to _variables: would this follow the framework style guidelines? |
Yeah sure, I don't think there are any fixed guidelines yet, so we are open to make some. For my part, I like the approach from material design specs. So we do not have to reinvent the wheel with custom vars, but yeah i also like the interface approach with the var mapping. Lets move from here on. Sounds good to me 👍 |
1f96c0e
to
5182e46
Compare
After implemented the secondary-container-color for navBar as commented, the materialize web looked like this: Is not bad, but personally I didn't like very much this tone for the main header. I have been doing some proofs with different colors, but this secondary-container-color is always a secondary-90 tone, always very light... For this reason I decided to recover the colors.module file and add a .primary class to the navBar in the header.
|
To be honest, I think we should avoid relying on classes coming from m3. Unless we explicitly want to say, that materializecss is m3 based. Rather than relying on a class, I would make navBar rely on another variable. So that when a user modifies corresponding CSS variable, he can expect that navbar color changes as well. However if we use |
We are not forcing to use M3 classes. Using this classes is just a theme option and can be changed, just assigning _theme_variables.scss values to your preferences (exactly as before). Adding this --secondary-container-color variable is needed to give te option to use that M3 color specification (and of course, the framework main page already states that it is following Googles Material guidelines). The .primary class is just a class added to top navbar in materializecss website, it does not affect the components at all. And I don't pretend this to be the final look and feel of the website. It could be seen as an example of how to change the default component styles in some places (precisely trying not to be forced to use M3 style everywhere). |
My suggestion would be to use the M3 Vars as a standard styling globally and for all components. Also I would exclude all the colors from the core library and make it as a seperate module or css file. Because I think in 80% of the use cases it is ok to just use primary and secondary and some warning and danger colors like defined in M3. If there are more colors needed then they can easily integrated. Edit: I think in the long-term we should move in the direction of M3 Styling of the components because this is the overall mission of this framework. But it should stay independent and open. Also i think the guidelines from Google are very well organized and are used by many others too, so we should orient on them but not depend on them 👍 |
is this ready for a merge? |
Yes it is. Now it includes fixes for the sidenav elements and it looks quite well |
Ok awesome! Lets merge it and after that, seperate the Website step by step from the materialize core with the Vite-Proof. Also: |
Is this ok for the other members too? @bugy @mauromascarenhas |
Ok, its the dev branch. So lets merge it anyways. |
Guys, I'm sorry I was not able to check it before, but I was still reviewing the changes applied. I have four points from what I could notice from the applied changes:
|
So how do I use this if I'm not using SASS? I made a theme with that website and exported it to CSS. I extracted the "light.css" into my project. I added the light.css stylesheet to my page with the materialize components, expecting it all to magically change to my theme colors, but I'm still left with the default materialize colors (navbar has light blue background and white text....) Some other website said something about adding a bunch of classes to my components, like |
you can import the |
Thank you! |
haha okay. i just realized there is a documentation on how to do it. https://materializeweb.com/themes.html. p/s need to update it later tho |
Proposed changes
As commented in discussion #397, this updates _theme_variables.scss to use variables coming from m3 theme builder website.
This way new styles can be created just replacing tokens.module.scss with the file generated by the site (there is an example on a new theme in the 2nd commit of this PR).
IMPORTANT: this looks quite well in the presented examples, but is not completed. Some variables from _theme_variables.scss have constant values and should be replaced by values using M3 variables. This should be done checking how this variables are used in MaterializeCSS and what is the corresponding variable following M3 color indications.
NOTE: I see this PR, more like a way to discuss and doing proofs than for actually using it as-is.
Screenshots:
See discussion #397 for screenshots.
Types of changes
SCSS Styles
Checklist: