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

Provide a palette of system colors #2843

Open
freakboy3742 opened this issue Sep 14, 2024 · 0 comments
Open

Provide a palette of system colors #2843

freakboy3742 opened this issue Sep 14, 2024 · 0 comments
Labels
enhancement New features, or improvements to existing features.

Comments

@freakboy3742
Copy link
Member

What is the problem or limitation you are having?

Toga's style engine has a (largely undocumented) concept of SYSTEM_FONT_SIZE - the default font size for text on the platform. It should also expose a selection of system colors that can be used.

Describe the solution you'd like

Most platforms have a palette of "standard" colors - primary, secondary (, tertiary...) text color, hyperlink color, border color etc. Toga should determine a reasonable subset of "common" system colors, expose those as constants through Pack, and modify color handling so that if a "system" color is requested, a platform appropriate color is used.

This likely means defining constants like toga.colors.SYSTEM_PRIMARY_TEXT that can be mapped to platform-specific shades.

Interestingly, CSS has a specification for this - but they've been deprecated. This seems to be because in the HTML context, the potential for HTML pages to spoof actual system dialogs etc is dangerous - but in our case, that's what we're trying to do. It might make sense to use these constants (or a subset of them), even though they've been formally deprecated from the standard.

Describe alternatives you've considered

Status quo - the system colors will be used if there's no explicit color provided, but it doesn't provide any way to use those colors in a different context.

Additional context

See #2830 for the original request.

@freakboy3742 freakboy3742 added the enhancement New features, or improvements to existing features. label Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features, or improvements to existing features.
Projects
None yet
Development

No branches or pull requests

1 participant