Skip to content
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

Is is possible to change theme in real time #51

Open
boxtree opened this issue Sep 14, 2016 · 2 comments
Open

Is is possible to change theme in real time #51

boxtree opened this issue Sep 14, 2016 · 2 comments

Comments

@boxtree
Copy link

boxtree commented Sep 14, 2016

Is it possible to change the theme (colors) in real time on a running site?

The zodiase-mdl.json file has the default theme colors, I would like to have the MDL color selection wheel on my site (or similar) and then allow a user pick their own color theme.

Thanks

@Zodiase
Copy link
Owner

Zodiase commented Sep 16, 2016

TL;DR: No out of box support from this package.

Well... Let's look at it this way: you want different users to see different themes, which means there has to be a mechanism for generating the theme stylesheet on the fly, based on whatever criteria you want. In other words, you need something at the client side to request for a theme stylesheet after the user is logged in, and at server side a nodejs program to compose the stylesheet. To make theming easy, hopefully the nodejs program only needs to compose SASS code. But for the client to consume the stylesheet, the final data has to be CSS code. So somehow you have to use a SASS compiler to produce the final CSS code.

With all the above setup, you can configure theming variables in your dynamic SASS code then load the MDL theme SASS to produce CSS files with different MDL themes.

@Zodiase
Copy link
Owner

Zodiase commented Sep 16, 2016

If you are only interested in the pre-built theme CSS files, use the undocumented hidden method _mdlGetAsset('dist/material.amber-cyan.min.css') on the server side to get the amber-cyan theme CSS file data. You still need some dynamic CSS loading on the client side and a server endpoint to serve the raw CSS data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants