Androidのthemeでは、色々な色を指定できます。必要に応じて editTextStyle
のようにWidgetごとのstyleやthemeを指定することもありますが、どのようなcolors属性を指定できるのかをざっと知っておくといざという時に便利です。
大まかに Android Platform、AppCompat、Material Componentsあたりを網羅できればいいと思うのですが、定義が多すぎて整理しづらかったのでcolor関連の属性だけ集めてMarkdownのテーブルにするスクリプトを書きました。
https://github.com/konifar/android-theme-attrs-to-markdown-table
android_framework
のみに◯がついているものは、属性の指定時に android:
namespaceが必要です。全体でどんな属性があるのか、MaterialComponentsのみ指定できる属性にはどんなものがあるのか、といったことは把握できると思います。それぞれの属性の説明については、各attrs.xmlのコメントに記載されています。
attr name | android_framework | appcompat | material_components |
---|---|---|---|
actionMenuTextColor | ◯ | ◯ | ー |
colorAccent | ◯ | ◯ | ◯ |
colorActivatedHighlight | ◯ | ー | ー |
colorBackground | ◯ | ー | ー |
colorBackgroundCacheHint | ◯ | ー | ー |
colorBackgroundFloating | ◯ | ◯ | ◯ |
colorButtonNormal | ◯ | ◯ | ー |
colorControlActivated | ◯ | ◯ | ー |
colorControlHighlight | ◯ | ◯ | ー |
colorControlNormal | ◯ | ◯ | ー |
colorEdgeEffect | ◯ | ー | ー |
colorError | ◯ | ◯ | ◯ |
colorFocusedHighlight | ◯ | ー | ー |
colorForeground | ◯ | ー | ー |
colorForegroundInverse | ◯ | ー | ー |
colorLongPressedHighlight | ◯ | ー | ー |
colorMultiSelectHighlight | ◯ | ー | ー |
colorOnBackground | ー | ー | ◯ |
colorOnError | ー | ー | ◯ |
colorOnPrimary | ー | ー | ◯ |
colorOnSecondary | ー | ー | ◯ |
colorOnSurface | ー | ー | ◯ |
colorPressedHighlight | ◯ | ー | ー |
colorPrimary | ◯ | ◯ | ◯ |
colorPrimaryDark | ◯ | ◯ | ◯ |
colorPrimaryVariant | ー | ー | ◯ |
colorProgressBackgroundNormal | ◯ | ー | ー |
colorSecondary | ◯ | ー | ◯ |
colorSecondaryVariant | ー | ー | ◯ |
colorSurface | ー | ー | ◯ |
colorSwitchThumbNormal | ◯ | ◯ | ー |
editTextColor | ◯ | ◯ | ー |
fastScrollTextColor | ◯ | ー | ー |
floatingToolbarDividerColor | ◯ | ー | ー |
floatingToolbarForegroundColor | ◯ | ー | ー |
panelColorBackground | ◯ | ー | ー |
panelColorForeground | ◯ | ー | ー |
textColorAlertDialogListItem | ◯ | ◯ | ー |
textColorHighlightInverse | ◯ | ー | ー |
textColorHintInverse | ◯ | ー | ー |
textColorLinkInverse | ◯ | ー | ー |
textColorPrimary | ◯ | ー | ー |
textColorPrimaryActivated | ◯ | ー | ー |
textColorPrimaryDisableOnly | ◯ | ー | ー |
textColorPrimaryInverse | ◯ | ー | ー |
textColorPrimaryInverseDisableOnly | ◯ | ー | ー |
textColorPrimaryInverseNoDisable | ◯ | ー | ー |
textColorPrimaryNoDisable | ◯ | ー | ー |
textColorSearchUrl | ◯ | ◯ | ー |
textColorSecondary | ◯ | ー | ー |
textColorSecondaryActivated | ◯ | ー | ー |
textColorSecondaryInverse | ◯ | ー | ー |
textColorSecondaryInverseNoDisable | ◯ | ー | ー |
textColorSecondaryNoDisable | ◯ | ー | ー |
textColorTertiary | ◯ | ー | ー |
textColorTertiaryInverse | ◯ | ー | ー |
textUnderlineColor | ◯ | ー | ー |
tooltipBackgroundColor | ◯ | ー | ー |
tooltipForegroundColor | ◯ | ◯ | ー |
以上。