Skip to content

Use the theme's disabled colors for disabled widgets on Android - #4932

Merged
freakboy3742 merged 3 commits into
beeware:mainfrom
kattni:android-disabled-button-color
Dec 4, 2026
Merged

freakboy3742 merged 3 commits into
beeware:mainfrom
kattni:android-disabled-button-color

Conversation

@kattni

@kattni kattni commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Refs #4914.

On Android, disabled buttons are now readable, and look disabled.

  • With a Material 3 theme, a disabled button kept its enabled text color, so light mode showed white text on pale gray. Toga saved only the enabled text color, and used it for every state. It now keeps the theme's colors for every state, as proposed in Keep the theme's disabled text color when an Android color is reset jkingok/beeware-toga#3.
  • That alone makes disabled text hard to read on a custom background. A button's custom colors now only apply while it's enabled.
  • Disabled labels, text inputs and switches share this code, so their default text is now faded too.

Verified with the full Android testbed on an API 31 emulator: 499 passed, 93 skipped, 56 xfailed, 6 xpassed, with 100.0% coverage. The new test fails without the fix. Other backends were not run locally.

PR Checklist:

  • I will abide by the BeeWare Code of Conduct
  • I have read and have followed the CONTRIBUTING.md file
  • This PR was generated or assisted using an AI tool

Assisted-by: Claude Code (Claude Opus 5.5)

@freakboy3742 freakboy3742 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small tweak to how the test skip is handled, but otherwise, this look great. Thanks!

Comment thread testbed/tests/widgets/test_button.py Outdated
Comment on lines +114 to +115
if toga.platform.current_platform != "android":
skip("Custom colors are only overridden by disabled colors on Android")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We prefer not to have explicit platform callouts; it's better to use a method or property on the probe that allows the probe to opt in/out of the test (in this case, skipping on most platforms, xfailing on macOS because the test doesn't apply).

@freakboy3742
freakboy3742 merged commit 866bdf5 into beeware:main Dec 4, 2026
61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants