Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tree does not implement styles #3005

Open
dwelden opened this issue Nov 30, 2024 · 7 comments
Open

Tree does not implement styles #3005

dwelden opened this issue Nov 30, 2024 · 7 comments
Labels
bug A crash or error in behavior. linux The issue relates Linux support.

Comments

@dwelden
Copy link

dwelden commented Nov 30, 2024

Describe the bug

Working on adding a dark mode to an application. All widgets except tree can be restyled with color and background color.

Steps to reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

Tree control should allow changing color and background color.

Screenshots

Screenshot from 2024-11-30 10-35-46

Environment

  • Operating System: Linux Mint 22 (based on Ubuntu Noble)
  • Python version: 3.12.3
  • Software versions:
    • Briefcase: 0.3.20
    • Toga: 0.4.8
    • toga-gtk: 0.4.7 (in pyproject.toml)

Logs


Additional context

No response

@dwelden dwelden added the bug A crash or error in behavior. label Nov 30, 2024
@HalfWhitt
Copy link
Contributor

Do other style properties work on Tree on your platform? Font settings, text alignment, dimensions?

@dwelden
Copy link
Author

dwelden commented Nov 30, 2024

Do other style properties work on Tree on your platform? Font settings, text alignment, dimensions?

font_family and font_weight works. color and background color have no effect. This appears to be using toga-gtk 0.4.7

@freakboy3742
Copy link
Member

Thanks for the report - it seems like there's likely 2 bugs here:

  1. color and background_color not being honoured
  2. dark mode not being honoured with appropriate default colors

The latter might be an issue with the specific GTK theme you're using; if that theme doesn't define a dark mode palette for the Table widget, then the default colors won't follow dark mode.

@freakboy3742 freakboy3742 added the linux The issue relates Linux support. label Dec 2, 2024
@dwelden
Copy link
Author

dwelden commented Dec 2, 2024

Honestly I may be misleading by referring to "dark mode" now that I see there are enhancements directed that way. I am just cycling through all widgets and changing color and background color. No themes or other techniques but manual style change.

@freakboy3742
Copy link
Member

Thanks for that detail.

FWIW, I'd strongly recommend that if you're manually tweaking the colors of each individual widget, you're not using Toga the way it was intended to be used. Toga deliberately tries to honor native platform look and feel; to that end, there are some facilities to modify colors on widget, but broadly speaking, they should be considered an edge case for minor UI tweaks, not the basis of a "whole of app theming system".

That doesn't change the fact that what you've found is a bug, and we'll merge a fix if one was submitted as a PR. However, in the scope of the rest of Toga, we consider it a low priority bug, because broadly speaking you shouldn't need to change the colors of widgets. If you don't like the colors that your operating system is providing for apps, take that up with your operating system.

On the other hand, if we're not honoring an OS-level dark mode setting, that would be a bug. However, in this case, it sounds like that isn't what is happening.

@dwelden
Copy link
Author

dwelden commented Dec 2, 2024

Well my concern isn't following OS theme. I want to give the option of toggling between light and dark mode independently of OS setting. Did not find a way other than manually resetting colors. Is there a more Toga-ish approach to that?

@freakboy3742
Copy link
Member

No - because "independent of OS setting" isn't a usage pattern Toga encourages. The OS defines what widgets look like. In Toga's worldview, it's not up to the app designer to determine how the app should look to the user, outside of minor UX-related tweaks (e.g., making text red to make it stand out as an alert). The user is the best arbiter of what their apps should look like, and they can configure their preferences at the operating system level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A crash or error in behavior. linux The issue relates Linux support.
Projects
None yet
Development

No branches or pull requests

3 participants