简体   繁体   English

在Angular中的运行时期间更改应用程序主题

[英]Change app theme during runtime in Angular

I am trying to implement different color pallets to style our app, and have Angular use one of them during runtime. 我正在尝试实现不同的颜色托盘来样式化我们的应用程序,并让Angular在运行时使用其中之一。

The use case is we have a UI that will be used by different clients, and each likes it to use a different set of colours. 用例是我们有一个供不同客户端使用的UI,每个用户都喜欢它使用不同的颜色集。 So, after the user logs in depending on which company they belong to I'd like Angular to load a different set of colours. 因此,在用户根据他们所属的公司登录后,我希望Angular加载不同的颜色集。

I found a couple of approaches using CSS variables but unfortunately we need to support IE 😡. 我发现了几种使用CSS变量的方法,但是不幸的是我们需要支持IE😡。

Is this possible? 这可能吗?

Thanks 谢谢

You can view this blog post here 您可以在这里查看此博客文章

The author explain to use scss in this case and simply inject scss variable at runtime. 作者解释了在这种情况下使用scss并在运行时简单地注入scss变量。

For your concern 为了您的关心

I found a couple of approaches using CSS variables but unfortunately we need to support IE 我发现了几种使用CSS变量的方法,但不幸的是我们需要支持IE

You need to add some polyfill for that 您需要为此添加一些polyfill

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM