-
-
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
[help] How to add a custom color to the palette ? #874
Comments
You can either do it via custom CSS or theme customization. With custom CSS you have to target all elements on your own. Customization is the better approach. Please see the guide on customization for more information. |
Thanks! |
I'm having trouble overriding |
You need to build the theme to use custom colors through SCSS variables. Please see the guide on theme customization |
Hm, is it possible to perhaps make this a little easier? The docs says "If you want to make more fundamental changes, it may be necessary to make the adjustments directly in the source of the Material theme and recompile it. This is fairly easy.", but I wouldn't call just tweaking the I think it's something that quite a few users would want to do (for example to fit some company colors), and having to set up essentially a dev environment and rebuild the entire theme just to do that is a little awkward. If it's not really feasible technically, I understand that and you can ignore this comment :) |
Well, there are two ways:
Most themes don't even have the first option as they have no build step. If you come up with an easier way that is still maintainable, I'm happy to integrate it. |
@squidfunk Thanks for the quick answer (!). However, I just found out that it's as simple as theme:
name: 'material'
palette:
primary: 'blue grey'
accent: 'deep orange' in the |
Oh, I thought you already knew that. It's not in the customization docs because it's considered configuration and therefore listed in the getting started guide |
@squidfunk Bah, I went straight for "Customization" and totally missed this. Thanks. I see now though that this must be a named color from the Material Design color palette, e.g. "#abcdef" would not work? (would require theme rebuilding). |
That is correct. Material provides shades for all colors from the Material Design color palette. In order to use custom colors you need to follow one of the steps outlined above. Note that when you decide on customization and define the variables, the theme will also adjust all derived colors (i.e. darker and lighter shades) from the primary colors which you would have to do on your own when overriding with custom CSS. |
Yes, makes total sense. Thanks. |
(and I see no obvious way of simplifying adding a custom color, due to the static nature of CSS) |
We've been iterating on this topic for quite some time ;-) |
Description
Hello, thanks a lot for this beautiful theme :)
My question is really simple:
How to add a custom color to the palette ?
Thanks :)
The text was updated successfully, but these errors were encountered: