Skip to content

fix(Color): blueF() to return correct channel and tighten validation/docs#59716

Open
joshtrichards wants to merge 6 commits into
masterfrom
jtr/fix-color2
Open

fix(Color): blueF() to return correct channel and tighten validation/docs#59716
joshtrichards wants to merge 6 commits into
masterfrom
jtr/fix-color2

Conversation

@joshtrichards
Copy link
Copy Markdown
Member

Summary

This fixes OCP\Color::blueF() to return the correct channel and cleans up OCP\Color to make its API contract and behavior clearer.

  • fix blueF() to return the blue - not green - channel
  • clarify mixPalette() and alphaBlending() docs so they match actual current behavior
  • add typed promoted properties
  • dd input validation for channel ranges, palette steps, and blend opacity
  • remove the unused legacy OC\Color class
  • refactor internal helper naming for readability

Notes:

  • we may want to consider switching to/using round() instead of raw int truncation for better interpolation quality, but I didn't want to risk blindly introducing that change in this public API
  • mixPalette() behavior is intentionally unchanged: it returns a list that starts with $color1 and progresses toward $color2, excluding $color2 (now documented accurately!)
  • alphaBlending() behavior is intentionally unchanged; this change documents and validates the existing contract
  • stricter typing/validation may reject invalid inputs that were previously tolerated, but this should primarily surface already-invalid call paths
  • validated against current avatar usage and updated the related test accordingly

P.S. I spent an embarrassing amount of time on this tiny class. 😆

TODO

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@joshtrichards joshtrichards added feature: theming feature: users and groups bug ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) labels Apr 20, 2026
@joshtrichards joshtrichards added this to the Nextcloud 34 milestone Apr 20, 2026
@joshtrichards joshtrichards added the 3. to review Waiting for reviews label Apr 20, 2026
@joshtrichards joshtrichards marked this pull request as ready for review April 20, 2026 01:53
@joshtrichards joshtrichards requested a review from a team as a code owner April 20, 2026 01:53
@joshtrichards joshtrichards requested review from Altahrim, ArtificialOwl, icewind1991 and salmart-dev and removed request for a team April 20, 2026 01:53
@joshtrichards
Copy link
Copy Markdown
Member Author

Aww, crap. Forgot to update+commit the autoloader change. I'll do it later when I can pull the branch down (unless someone else beats me to it).

Signed-off-by: Josh <josh.t.richards@gmail.com>
See #32973

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug feature: theming feature: users and groups ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants