color-颜色属性对照表

  • 更新时间:2025-12-02 10:12:44

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
colorTertiary com.google.android.material.R.attr.colorTertiary
colorOnTertiary com.google.android.material.R.attr.colorOnTertiary
colorTertiaryContainer com.google.android.material.R.attr.colorTertiaryContainer
colorOnTertiaryContainer com.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"

等同:颜色="红色"