Add utility methods to darken/lighten colors
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 827
- Avg merge
- 15h 39m
- Merged PRs (30d)
- 40
Description
### What is the problem or limitation you are having?
Tools like SCSS and SASS provide utility methods to darken an lighten colors. These can be useful for defining de-emphasized secondary headings etc. Toga should provide utility methods to
### Describe the solution you'd like
It should be possible to call `toga.Color(...).lighten(X)` or `toga.Color(...).darken(X)` to generate a new color that is lighter/darker by X% (where X is a float in the range 0-1).
It may also be useful to have analogs of these methods that go in the right "direction" when dark mode is taken into account (i.e. in light mode, lightening is used for de-emphasis; but in dark mode, darkening is used for de-emphasis). See #2841 for a related issue.
### Describe alternatives you've considered
This is already possible using HSL colorspace definitions; however, Travertino doesn't provide mechanism for converting from RGBA to HSLA.
### Additional context
See #2830 for the original request.
Contributor guide
Research direction
Start from the toga.Color entry point and read the existing color handling, then review the related requests in #2830 and #2841. Define how the percentage changes apply and whether dark-mode-aware variants belong in this work; done means the requested lighten/darken behavior is covered with tests for the stated 0-1 range.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- design, frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100