Skip to content

Keep the hue when lch lightness is none - #81

Closed
SashaMIT wants to merge 1 commit into
Kozea:mainfrom
SashaMIT:lch-none-hue
Closed

SashaMIT wants to merge 1 commit into
Kozea:mainfrom
SashaMIT:lch-none-hue

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Oct 1, 2026 •

Copy link
Copy Markdown

parse_color("lch(none 50 180)") returned (None, 50, None). The hue is 180. oklch(none 0.1 180) dropped the hue the same way.

lab(none 10 20) already keeps 20, and lch(40 20 180) already keeps 180. The hue check looked at the lightness token, so a missing lightness hid a hue that was present. lch(50 20 none) came back as hue 0. That is a real hue, not a missing one. It is now none.

Fixes #80.

Test plan

  • pytest tests/test_tinycss2.py::test_lch_none_lightness_keeps_hue tests/test_tinycss2.py::test_color_lch_4 tests/test_tinycss2.py::test_color_oklch_4 tests/test_tinycss2.py::test_color_lab_4 (4501 passed)

Drafted with Grok 4.7. The code has not yet been reviewed by a human.

The hue channel checked the lightness token, so lch(none 50 180) dropped 180.
@grewn0uille

Copy link
Copy Markdown
Member

Please follow the guidelines.

@grewn0uille grewn0uille closed this Oct 1, 2026
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.

lch() drops the hue when lightness is none

2 participants