我正在使用ngx-admin模板和我的表格。我不使用NG2智能表。我试着把整个页面改成深色主题。当主题变为深色主题时,如何将表格颜色更改为深色主题?
我需要的桌子也要改变黑暗的主题。我该怎么做呢?
themes = [
{
value: 'default',
name: 'Light',
},
{
value: 'dark',
name: 'Dark',
},
{
value: 'cosmic',
name: 'Cosmic',
},
{
value: 'corporate',
name: 'Corporate',
},
];
currentTheme = 'default';
发布于 2021-07-12 01:32:55
你首先需要研究原始主题,以及如何将它们导入到你的项目中并利用它们。
但是为了回答这个问题,因为ngx-admin在主题改变时并不能处理所有的原始颜色。您必须订阅星云主题中的主题更改,并自行更新表。
themeClass: string = 'light-theme';
constructor(private themeService: NbThemeService) {
this.themeService.onThemeChange()
.subscribe((theme) => {
// Here is where you will know which theme is currently applied and you can do logic. For example (if setting theme by class):
this.themeClass = theme?.name == 'light' ? 'light-theme' : 'dark-theme';
});
}
https://stackoverflow.com/questions/68315342
复制相似问题