带有 md 颜色的白色背景

White background with md-colors

使用 angular material 中的 md-colors,是否可以将背景设置为白色 而无需 定义自定义白色托盘?

我想我可以使用灰色托盘,因为 documentation 说:

background - grey (note that white is in this palette)

所以我尝试做

<div md-colors="{background: 'grey-50'}">

但是grey-50还是浅灰色,不是白色

我尝试了 <div layout-padding md-colors="{background: 'white'}">,但 angular material 中似乎没有白色托盘。 我收到错误 angular.js:13711 mdColors: couldn't find 'white' in the palettes.,因为没有白色托盘。

有什么方法可以从灰色托盘中获取白色吗? (色调、不透明度等)

如果没有,是否有任何方法可以使用 angular material 从任何其他托盘访问白色?

如果一切都失败了,我可以定义一个完整的白色 pallet/theme 并使用它,但如果有正确的方法,我宁愿避免这样做。

您可以在 the theme file 的源代码中找到所有调色板及其颜色。

应该是A100但是我没试过

<div md-colors="{background: 'grey-A100'}">

您还可以使用 plunker 中的 md-colors 查看 Sander Elias 的颜色和色调。它演示了前景和背景的颜色 class 名称的结果。希望对你有帮助。

您可以尝试在 grey-50 处设置不透明度。像这样:

<div md-colors="{background: 'grey-50-0.1'}">

(其中 0.1 是不透明度)

完整文档: https://material.angularjs.org/1.1.2/api/directive/mdColors