Clarity now ships with stylesheets for both light and dark themes. We document how to consume them here with both angular-cli
or webpack
build configurations. That means that once the app is built, that is only style it has.
I have some ideas about how to implement a theme switcher for toggling between the two. Here is a rough idea I might start my prototype with:
- Build the app without either of the theme css files (no clarity style at all)
- Copy both css files to the assets folder (during the build)
- Write a directive or component that can take an
@Input
of the the src for a stylesheet in the <head>
- Store the both paths
/path/to/light.css
and /path/to/dark.css
in a service so the app could pass the active theme value around and modify it when needed.
- Add the service to the app components where we want to let users update the theme.
Does this give you some ideas for your app?
I'll update here after I have a prototype working so you can see it in action and find the source code.