Skip to content

Instantly share code, notes, and snippets.

@dlew
Last active March 1, 2024 15:46
Show Gist options
  • Save dlew/a2e2f247c78495eca4e6 to your computer and use it in GitHub Desktop.
Save dlew/a2e2f247c78495eca4e6 to your computer and use it in GitHub Desktop.
With the new theming in AppCompat, a lot of assets are tinted automatically for you via theme attributes. That has often led me to wonder "where the hell did this color come from?" You can replace your normal theme with this debug theme to help figure out the source of that color.
<!-- You can change the parent around to whatever you normally use -->
<style name="DebugColors" parent="Theme.AppCompat">
<!-- System colors -->
<item name="android:windowBackground">@color/__debugWindowBackground</item>
<item name="android:colorPressedHighlight">#FF4400</item>
<item name="android:colorLongPressedHighlight">#FF0044</item>
<item name="android:colorFocusedHighlight">#44FF00</item>
<item name="android:colorActivatedHighlight">#00FF44</item>
<item name="android:colorMultiSelectHighlight">#4400FF</item>
<item name="android:statusBarColor">#FFF000</item>
<item name="android:navigationBarColor">#000FFF</item>
<item name="android:colorForeground">#440000</item>
<item name="android:colorForegroundInverse">#004400</item>
<item name="android:colorBackground">#444400</item>
<item name="android:colorBackgroundCacheHint">#440044</item>
<item name="android:textColorPrimary">#FFFF00</item>
<item name="android:textColorSecondary">#FF00FF</item>
<item name="android:textColorTertiary">#00FFFF</item>
<item name="android:textColorPrimaryInverse">#CCCC00</item>
<item name="android:textColorSecondaryInverse">#CC00CC</item>
<item name="android:textColorTertiaryInverse">#00CCCC</item>
<item name="android:textColorPrimaryDisableOnly">#FFCC00</item>
<item name="android:textColorPrimaryInverseDisableOnly">#FF00CC</item>
<item name="android:textColorPrimaryNoDisable">#CCFF00</item>
<item name="android:textColorSecondaryNoDisable">#00FFCC</item>
<item name="android:textColorPrimaryInverseNoDisable">#CC00FF</item>
<item name="android:textColorSecondaryInverseNoDisable">#00CCFF</item>
<item name="android:textColorHint">#FF8800</item>
<item name="android:textColorHintInverse">#FF0088</item>
<item name="android:textColorHighlight">#88FF00</item>
<item name="android:textColorHighlightInverse">#00FF88</item>
<item name="android:textColorLink">#8800FF</item>
<item name="android:textColorLinkInverse">#0088FF</item>
<item name="android:textColorAlertDialogListItem">#444444</item>
<!-- Color palette (via app-compat) -->
<item name="colorPrimary">#FF0000</item>
<item name="colorPrimaryDark">#00FF00</item>
<item name="colorAccent">#0000FF</item>
<item name="colorControlNormal">#CC0000</item>
<item name="colorControlActivated">#00CC00</item>
<item name="colorControlHighlight">#0000CC</item>
<item name="colorButtonNormal">#880000</item>
<item name="colorSwitchThumbNormal">#008800</item>
<!-- Random other things found in app-compat -->
<item name="actionMenuTextColor">#440000</item>
<item name="editTextColor">#004400</item>
<item name="textColorSearchUrl">#000044</item>
</style>
<!-- Also needed, since windowBackground is a reference, not a color -->
<color name="__debugWindowBackground">#888888</color>
Copy link

ghost commented Sep 8, 2015

Best gist of the week!

Copy link

ghost commented Dec 21, 2015

Saved a lot of hours!

@mharper
Copy link

mharper commented Mar 12, 2018

Fantastic idea.

@badoualy
Copy link

Updating this with new material-components lib attributes would be awesome :)

@paul790905
Copy link

Good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment