WizardKnight WizardKnight - 1 month ago 13
Android Question

What is the default text color for theme.appcompat.light?

The title says it all, looking for the default color value used in TextViews in theme.appcompat.light

tried looking for it in Android studio by hitting ctrl on theme.appcompat.light but it brought me down a rabbit hole that I couldn't find the end of.

Answer

Looks like theme.appcompat.light goes all the way up to Platform.AppCompat.Light

By default I'm just going to assume you mean the primary color.

Here's what it looks like:

<style name="Platform.AppCompat.Light" parent="android:Theme.Light">
    <item name="android:windowNoTitle">true</item>

    ...

    <!-- Text colors -->
    <item name="android:textColorPrimary">@color/abc_primary_text_material_light</item>
    <item name="android:textColorPrimaryInverse">@color/abc_primary_text_material_dark</item>
    <item name="android:textColorSecondary">@color/abc_secondary_text_material_light</item>
    <item name="android:textColorSecondaryInverse">@color/abc_secondary_text_material_dark</item>
    <item name="android:textColorTertiary">@color/abc_secondary_text_material_light</item>
    <item name="android:textColorTertiaryInverse">@color/abc_secondary_text_material_dark</item>
    <item name="android:textColorPrimaryDisableOnly">@color/abc_primary_text_disable_only_material_light</item>
    <item name="android:textColorPrimaryInverseDisableOnly">@color/abc_primary_text_disable_only_material_dark</item>
    <item name="android:textColorHint">@color/hint_foreground_material_light</item>
    <item name="android:textColorHintInverse">@color/hint_foreground_material_dark</item>
    <item name="android:textColorHighlight">@color/highlighted_text_material_light</item>
    <item name="android:textColorLink">?attr/colorAccent</item>

    ...

</style>

Inside you'll see abc_primary_text_material_light:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_enabled="false" android:color="@color/primary_text_disabled_material_light"/>
    <item android:color="@color/primary_text_default_material_light"/>
</selector>

Which last but not least defines it's color as:

<color name="primary_text_default_material_light">#de000000</color>
Comments