Is there a way to dynamically change the color scheme of an Angular app by clicking a button, without relying on any additional UI libraries?
Here's what I'm trying to achieve - I have two files, dark.scss
and light.scss
, each containing variables like the example below but with different values.
:root{
--body-bg:#fff;
--frn-bg-color:#fff;
--input-border-color:#787878;
//...
}
In the styles.scss
file, these variables are called using @require './theme/dark.scss';
. However, this setup is static and requires rebuilding the app to switch to @require './theme/light.scss';
.
So my question is, how can I dynamically switch between theme files and apply a new color scheme without having to rebuild the entire app?