Skip to content

DetailedList text color hard-coded to black on Android (breaks dark mode) #3747

@rasmusJenle

Description

@rasmusJenle

Describe the bug

On Android, toga.DetailedList item text is rendered in hard-coded black.
This makes it unreadable when the app is in dark mode (Theme.Material3.DayNight.NoActionBar).
iOS adapts correctly to system dark/light mode.
Android theme background switches correctly, but list text does not follow.

Steps to reproduce

  1. Set up a Toga app on Android with:

base_theme = "Theme.Material3.DayNight.NoActionBar"

  1. Add a DetailedList with a few items.

  2. Switch the device/emulator to dark mode.

Expected behavior

DetailedList item text should use the theme’s primary/secondary text colors (white-ish in dark mode, black-ish in light mode).

Screenshots

Image Image

Environment

  • Operating System: macOS 15.6.1
  • Python: 3.13.4
  • Briefcase: 0.3.24
  • Toga: 0.5.2

Logs


Additional context

https://github.com/beeware/toga/tree/main/android/src/toga_android/widgets/detailedlist.py lines 183-185 state:

top_text.setTextColor(
self._native_activity.getResources().getColor(R.color.black)
)

and lines 187-189 state:

bottom_text.setTextColor(
self._native_activity.getResources().getColor(R.color.black)
)

Potential fix: Maybe black should be replaced with ?android:attr/textColorPrimary and ?android:attr/textColorSecondary (resolved at runtime).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA crash or error in behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions