Following the meteor react teams examples, I was able to create my own project from scratch and get all the dependencies in place to use material-ui package for my react front end.
var ThemeManager = new mui.Styles.ThemeManager();
is a necessary line of code. According to the material-ui website, something like:
ThemeManager.setTheme(ThemeManager.types.DARK);
should change the default light theme to the only other predefined theme in mui, “dark”.
However, it doesn’t work. Am I missing something??
It would help a lot of you could link to a git repo of a whole app, or try this approach on one of the official meteor react examples that use material ui and demonstrate that it doesn’t work.
I haven’t tried a fully customized color theme myself, but the instructions seem pretty straight forward. You can just look in the repo on github for the light or dark theme files (which are the two defaults), copy the file and then just replace all the options with your own choices of color.
Let me know if you take this on and get it to work in Meteor.
@uberom Thank you There is an option setPalette to the Theme which set the color palette to the theme. I changed only Primary and accent colors from the Palette and rest are left default. Its working great.
I’m wondering if you even need to set the theme to LIGHT at all. That should be the default theme already set whenever you instantiate a new ThemeManager. Have you tried taking that line of code out?
@uberom
In the above code snippet, I am setting only Palette instead of whole Theme, which overrides whatever colors are set in palette and for the rest it takes for the theme.
Ok, LIGHT is a default theme so here we don’t need that line of code. But I mentioned it for general purpose if someone wants to use any other theme.
Hello, this code works great but where is the logical location to call the setPalette / setTheme function? getChildContext? I am still very new to React. Thanks!
// rest of the palette is set from Theme Manager
};
var ThemeManager = mui.Styles.ThemeManager;
var Theme = ThemeManager.getMuiTheme(mui.Styles.LightRawTheme);
var newTheme = ThemeManager.modifyRawThemePalette(Theme,appPalette);
return {
muiTheme : newTheme
}
I’m using the Callemall dependency. I am wondering how I can change the AppBar color and height. Is this possible by using inline styles to override the theme variables? Do I need to specify my own raw theme in a separate file?