color-颜色属性对照表

  • 更新时间:2026-02-08 19:44:15

1. 属性颜色

属性值颜色
colorPrimary、主题com.google.android.material.R.attr.colorPrimary
colorSurface、背景com.google.android.material.R.attr.colorSurface
colorOnSurface、文本com.google.android.material.R.attr.colorOnSurface
colorOnPrimary、主题主反色com.google.android.material.R.attr.colorOnPrimary
colorPrimaryContainer、主题主容器颜色com.google.android.material.R.attr.colorPrimaryContainer
colorOnPrimaryContainer、主题主容器反色com.google.android.material.R.attr.colorOnPrimaryContainer
colorSecondary、主题次颜色com.google.android.material.R.attr.colorSecondary
colorOnSecondary、主题次反色com.google.android.material.R.attr.colorOnSecondary
colorSecondaryContainer、主题次容器颜色com.google.android.material.R.attr.colorSecondaryContainer
colorOnSecondaryContainer、主题次容器反色com.google.android.material.R.attr.colorOnSecondaryContainer
colorTertiarycom.google.android.material.R.attr.colorTertiary
colorOnTertiarycom.google.android.material.R.attr.colorOnTertiary
colorTertiaryContainercom.google.android.material.R.attr.colorTertiaryContainer
colorOnTertiaryContainercom.google.android.material.R.attr.colorOnTertiaryContainer
colorError、主题错误颜色com.google.android.material.R.attr.colorError
colorOnError、主题错误反色com.google.android.material.R.attr.colorOnError
colorErrorContainer、主题错误容器颜色com.google.android.material.R.attr.colorErrorContainer
colorOnErrorContainer、主题错误容器反色com.google.android.material.R.attr.colorOnErrorContainer
colorOnBackground、主题背景反色com.google.android.material.R.attr.colorOnBackground
colorSurfaceVariant、主题中性容器颜色com.google.android.material.R.attr.colorSurfaceVariant
colorOnSurfaceVariant、主题中性容器反色com.google.android.material.R.attr.colorOnSurfaceVariant
colorOutline、主题中性轮廓颜色com.google.android.material.R.attr.colorOutline
colorOutlineVariant、主题中性轮廓反色com.google.android.material.R.attr.colorOutlineVariant
colorPrimaryInverse、主题主状态反色com.google.android.material.R.attr.colorPrimaryInverse

2. 名称颜色

属性值颜色
white、白色#FFFFFF
black、黑色#000000
null、透明、none、空、无#00000000
green、绿色#57965C
red、红色#C94F4F
blue、蓝色#3574F0
yellow、黄色#C29E4A
注意

由于脚本支持中文和英文编程,所以颜色属性值可以采用中文,也可以采用英文。

例如:color="red"

等同:颜色="红色"