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

根据设备主题修改主题色 #898

Open
happyfeet1996 opened this issue Apr 19, 2024 · 1 comment
Open

根据设备主题修改主题色 #898

happyfeet1996 opened this issue Apr 19, 2024 · 1 comment

Comments

@happyfeet1996
Copy link

What problem does this feature solve?

能够根据设备主题颜色动态修改组件主题颜色

What does the proposed API look like?

仿照ionic,通过
@media(prefers-color-scheme: dark){
//深色主题的css文件
}

@happyfeet1996
Copy link
Author

目前我搞了个临时解决方案:

  1. 首先新建一个less文件定义你的不同主题的颜色
    image
  2. 使用less将less文件编译成css文件;
  3. 编译完成后将css文件拷贝到assets下面;
  4. 在app.component.ts写如下代码:
    image
    备注:上述代码仅仅是监听了设备主题变化了,如果需要默认适配,可以把直接添加css文件。

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

1 participant