beeware / beeware/toga

Add utility methods to darken/lighten colors

Open
#2,842 1 comment 0 reactions 0 assignees View on GitHub
enhancement
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.