• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Default dark text color in dark mode on the action bar

davix10

Lurker
Oct 27, 2023
2
0
In light mode I have no problems because everything is correct but in dark mode without making any changes the text remains dark. Is it an Android bug? I have tried various methods but my problem is that I have to disable some menu options and then I lose the color in disabled mode, it always seems enabled. Is it just my problem? In this way the text is illegible I use this theme: Theme.MaterialComponents.DayNight.DarkActionBar
Cattura.PNG
 
Which phone, which android version, and how are you applying the theme you name?

I've been using the system dark mode since it was first made available as a built-in feature several years ago and on different devices, and have never experienced this. So I don't think this an Android bug. However each manufacturer builds and customises Android for their own devices, so I can't rule out the possibility that a particular manufacturer has introduced a bug in a particular device.

That is, of course, assuming you are only talking about the system dark mode and not applying any add-on theme, either by itself or in addition to the system dark mode. If you are using any add-on theme, even from the device's theme store, then it's more likely that the bug is in that theme rather than the system. What you show here was a common problem with one popular theming tool in Android 8, and the only solution was to try to customise the theme or find a different one that wasn't buggy. This is why I asked how you apply the theme.
 
Upvote 0
I tried on multiple devices and on multiple Android versions, the result does not change. This is the code for my theme.
XML:
<resources xmlns:tools="http://schemas.android.com/tools">
    <!-- Base application theme. -->
    <style name="Theme.LiteOT" parent="Theme.Material3.DayNight">
        <!-- Primary brand color. -->
        <item name="colorPrimary">@color/purple_500</item>
        <item name="colorPrimaryVariant">@color/purple_700</item>
        <item name="colorOnPrimary">@color/black</item>
        <!-- Secondary brand color. -->
        <item name="colorSecondary">@color/teal_200</item>
        <item name="colorSecondaryVariant">@color/teal_200</item>
        <item name="colorOnSecondary">@color/black</item>
        <!-- Status bar color. -->
        <item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
        <!-- Customize your theme here. -->
        <item name="android:textColorPrimary">@color/white</item>

    </style>

</resources>

I also tried changing from Theme.MaterialComponents.DayNight.DarkActionBar to Theme.Material3.DayNight but nothing changed. I noticed that the problem is present from the start of the new project if I do it with the Navigation Drawer View. With the others there are no problems.
 

Attachments

  • Cattura.PNG
    Cattura.PNG
    86.4 KB · Views: 21
Upvote 0
OK, so it's a theme that you are developing that isn't working. That is useful to know: when asking for help it's always good to explain the background, because we only know what you write and trying to guess what's going on that you haven't said wastes everyone's time.

Given that people are able to write themes without this problem, and the base android dark mode doesn't suffer from this, there must be a solution. I'm afraid I can't help with this myself as I've not played with such things for many years, but hopefully someone who can will read this.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones