| fix(colors): regenerate colors.py HSL from RGB via generator script The 256-colour table's HSL column was hand-entered and had corrupted rows (e.g. DeepSkyBlue4 #005f87 stored hue 97 where the real hue is 198), so any gradient interpolating through those colours blended through the wrong hue. A handful of lightness values were also off by a rounding step (e.g. NavyBlue 18 -> 19). Add tools/generate_colors.py, which parses the current colors.py to recover the authoritative (binding, RGB, name, xterm) tuples and re-emits every Colors.register(...) line with HSL derived from RGB via HSL.from_rgb. RGB, xterm index, colour name, Python binding name and source order are all preserved verbatim, including the deliberate last-wins duplicate bindings (blue3, deep_sky_blue4, ...); only the HSL column changes. The generator is idempotent (HSL is always recomputed, never read back) and offers --check. tests/test_color.py gains test_registered_color_hls_matches_rgb, which guards every registered colour's stored HSL against HSL.from_rgb(rgb) so the two can never drift apart again. | 1 个月前 |
| fix(colors): regenerate colors.py HSL from RGB via generator script The 256-colour table's HSL column was hand-entered and had corrupted rows (e.g. DeepSkyBlue4 #005f87 stored hue 97 where the real hue is 198), so any gradient interpolating through those colours blended through the wrong hue. A handful of lightness values were also off by a rounding step (e.g. NavyBlue 18 -> 19). Add tools/generate_colors.py, which parses the current colors.py to recover the authoritative (binding, RGB, name, xterm) tuples and re-emits every Colors.register(...) line with HSL derived from RGB via HSL.from_rgb. RGB, xterm index, colour name, Python binding name and source order are all preserved verbatim, including the deliberate last-wins duplicate bindings (blue3, deep_sky_blue4, ...); only the HSL column changes. The generator is idempotent (HSL is always recomputed, never read back) and offers --check. tests/test_color.py gains test_registered_color_hls_matches_rgb, which guards every registered colour's stored HSL against HSL.from_rgb(rgb) so the two can never drift apart again. | 1 个月前 |