gpt4 book ai didi

javascript - 为 Angular Material 配置深色主题

转载 作者:数据小太阳 更新时间:2023-10-29 04:45:51 27 4
gpt4 key购买 nike

我正在为我的网络应用程序设计,我想要一个与看到的类似的深色主题 here .

遗憾的是我找到了 Angular Material Theming Docs很难理解;没有提及每种颜色将在哪里使用,如何设置背景颜色或文本颜色等。

我目前正在使用:

.config(function($mdThemingProvider) {
$mdThemingProvider.definePalette('coolpal', {"50":"#d9ddec","100":"#a6b1d2","200":"#8190bf","300":"#5468a5","400":"#495b90","500":"#252830","600":"#354168","700":"#2a3453","800":"#20283f","900":"#161b2b","A100":"#252830","A200":"#a6b1d2","A400":"#495b90","A700":"#2a3453"});
$mdThemingProvider.definePalette('accentpal', {"50":"#ffffff","100":"#bfe7f7","200":"#8dd5f1","300":"#4ebee9","400":"#32b4e5","500":"#1ca8dd","600":"#1993c2","700":"#157fa7","800":"#126a8c","900":"#0e5570","A100":"#ffffff","A200":"#bfe7f7","A400":"#32b4e5","A700":"#157fa7"});
$mdThemingProvider.definePalette('warnpal', {"50":"#f0fdf9","100":"#adf4dc","200":"#7bedc7","300":"#3ce5ac","400":"#21e1a0","500":"#1bc98e","600":"#17ae7b","700":"#149368","800":"#107855","900":"#0d5d42","A100":"#f0fdf9","A200":"#adf4dc","A400":"#21e1a0","A700":"#149368"});


$mdThemingProvider.theme('default')
.primaryPalette('coolpal').dark()
.accentPalette('accentpal')
.warnPalette('warnpal')
.backgroundPalette('coolpal')
})

通过对颜色进行一些修改,效果还不错,但是如果我查看 md-toolbar 中的颜色,文本将设置为 rgba(0,0,0, 0.87); 我不知道如何改变它;我以为它会来 self 的 coolpal 主题中的某个地方,但事实并非如此。以下是我的文本元素的样式:

Angular Material mdthemingprovider example

如何更改 $mdThemingProvider 以确保文本是浅色而不是不透明的黑色?

最佳答案

我会建议扩展现有的调色板,更容易......例如;

var myPalette = $mdThemingProvider.extendPalette('indigo', {
'500': '183863'
});
$mdThemingProvider.definePalette('mine', myPalette);
$mdThemingProvider.theme('default')
.primaryPalette('mine').dark();

关于javascript - 为 Angular Material 配置深色主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33337447/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com