Skip to content

gh-102581: Add clipping in colorsys.py#149572

Closed
manoj-km24 wants to merge 6 commits intopython:mainfrom
manoj-km24:add-clipping-colorsys
Closed

gh-102581: Add clipping in colorsys.py#149572
manoj-km24 wants to merge 6 commits intopython:mainfrom
manoj-km24:add-clipping-colorsys

Conversation

@manoj-km24
Copy link
Copy Markdown
Contributor

@manoj-km24 manoj-km24 commented May 8, 2026

This PR addresses issue 102581 (link : #102581).
As discussed, adding an optional clip argument seems to be an aggressive expansion of the API and hence mandatory clipping and documenting it accordingly seems to be the best option.

Clipping is shown in function yiq_to_rgb() but not in any others. This makes the module inconsistent. This PR clips
RGB,HLS,HSV values and Y (from YIQ) in the range [0,1]. As for I and Q, For a valid RGB input, I stays between [-0.5957,0.5957] and Q stays between [-0.5226,0.5226]. (Source : https://en.wikipedia.org/wiki/YIQ#Formulas).

I can also update the documentation if needed.

@manoj-km24 manoj-km24 changed the title Add clipping in colorsys.py gh-102581: Add clipping in colorsys.py May 8, 2026
@read-the-docs-community
Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #32607090 | 📁 Comparing 62c8b8c against main (ebf6d9c)

  🔍 Preview build  

93 files changed · ± 91 modified · - 2 deleted

± Modified

- Deleted

@picnixz
Copy link
Copy Markdown
Member

picnixz commented May 8, 2026

I don't think a consensus has been reached. Can you please stop opening PRs for which no core dev expressed their opinions yet please? Instead we should try to revive #106254 if necessary as uniform clipping seemed to be desired.

@picnixz picnixz closed this May 8, 2026
@manoj-km24 manoj-km24 deleted the add-clipping-colorsys branch May 8, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants