Android Use custom themes to modify style attributes

After many failures of finding a clean solution I finally found an answer that works beautifully.

I created a custom attribute headerFontColor and added it to /res/values/attrs.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <attr name="headerFontColor" format="reference|color" />
</resources>

Next, in the style for HeaderFont I added updated the textColor to be the new custom attribute (headerFontColor) instead of a specific color

<style name="HeaderFont" parent="@android:style/TextAppearance.Medium">
    <item name="android:textColor">?headerFontColor</item>
</style>

Now, I can simply set the headerFontColor attribute based on the theme

<style name="RedTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
    <item name="android:textColor">@color/white</item>
    <item name="headerFontColor">@color/red</item>
</style>
<style name="GrayTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
    <item name="android:textColor">@color/white</item>
    <item name="headerFontColor">@color/gray</item>
</style>

After doing this, all TextViews that use the HeaderFont style get updated with the headerFontColor just by switching the Theme

This solution guided me: Setting a color based on theme