Skip to content

refactor: Have colord handle color manipulation - #653

Merged
cyanChill merged 5 commits into
devfrom
feat/colord
Nov 12, 2026
Merged

cyanChill merged 5 commits into
devfrom
feat/colord

Conversation

@cyanChill

@cyanChill cyanChill commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Why

This PR has the app use the colord package, a lightweight library for high-performance color manipulations and conversions. This makes it so we no longer manage this logic and instead, delegate the responsibility to the package.

Checklist

  • New files have the SPDX license identifier at the top of the file.
  • Documentation is up to date to reflect these changes.
  • Ensure dependency licenses are up-to-date by running pnpm sync:licenses.
  • This diff will work correctly for pnpm android:prod.

Summary by CodeRabbit

  • Bug Fixes

    • Improved color handling in theme customization, including color normalization and synchronization in the color picker.
    • Updated ripple effects, gradients, and translucent backgrounds to apply opacity more consistently across the app.
    • Improved validation and conversion of colors used in customization.
  • Chores

    • Added the colord package and its license information.

- It's a library for color manipulations & conversions, which we can use to replace our current color utils.
@cyanChill cyanChill added the Housekeeping Code maintenance or refactor. label Nov 12, 2026
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The mobile app adds shared color utilities based on colord. Customization modules and UI components use these utilities for color conversion, validation, normalization, and alpha color construction.

Changes: Color utility consolidation

Layer / File(s) Summary
Shared color utilities and normalization
mobile/src/utils/color.ts, mobile/src/modules/customization/theme/core/utils.ts, mobile/src/modules/customization/theme/helpers/colorConverter.ts, mobile/src/modules/customization/theme/utils.ts, mobile/package.json, THIRD_PARTY.md, mobile/src/resources/licenses.json
Adds shared color utilities and the colord dependency. Hex normalization uses colord; the theme-local converters and isHexColor type guard are removed.
Customization color handling
mobile/src/modules/customization/atmosphere/util.ts, mobile/src/modules/customization/theme/components/ColorPicker.tsx, mobile/src/modules/customization/theme/components/ColorPickerInput.tsx, mobile/src/modules/customization/theme/components/OpacitySlider.tsx, mobile/src/modules/customization/theme/hooks.ts
Customization modules use the shared color utilities. ColorPicker synchronizes state and initializes its hue slider using the normalized color. Atmosphere palette conversion uses colord.
UI alpha color construction
mobile/src/components/Base/Pressable.tsx, mobile/src/components/Gradient.tsx, mobile/src/components/next/base/ripple.tsx, mobile/src/components/next/composed/toolbar.tsx, mobile/src/navigation/screens/HomeView.tsx, mobile/src/navigation/screens/settings/AppUpdateView.tsx
Ripple, gradient, and background colors use withAlpha instead of appended hexadecimal alpha suffixes. Existing opacity values and gradient directions remain as described.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • MissingCore/Music#633: It relocates the toolbar backdrop gradient that this PR updates, so the backdrop changes may need reconciliation.
Merge Risk: Minimal · up to c3a42

The change moves color handling onto the colord package and keeps the existing alpha and validation behavior. No merge-blocking risk was found in the supplied review context.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "refactor: Have colord handle color manipulation" matches the main change. The PR adds the colord package and moves color conversion and manipulation logic (alpha handling, hex/HSV convers…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "refactor: Have colord handle color manipulation" matches the main change. The PR adds the colord package and moves color conversion and manipulation logic (alpha handling, hex/HSV conversion, contrast helpers) onto colord and a new utility module in mobile/src/utils/color.ts. The removed colorConverter.ts helpers and the new withAlpha/hexToHSV/hsvToHex utilities all fit this description. The title uses the conventional refactor prefix and is concise.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 99df530b-50bb-48b1-9453-2e640443fd09
Commits

Reviewing files that changed from the base of the PR and between 9cb0bda and c3a4262.

Files ignored due to path filters: 1

  • mobile/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 18

  • THIRD_PARTY.md
  • mobile/package.json
  • mobile/src/components/Base/Pressable.tsx
  • mobile/src/components/Gradient.tsx
  • mobile/src/components/next/base/ripple.tsx
  • mobile/src/components/next/composed/toolbar.tsx
  • mobile/src/modules/customization/atmosphere/util.ts
  • mobile/src/modules/customization/theme/components/ColorPicker.tsx
  • mobile/src/modules/customization/theme/components/ColorPickerInput.tsx
  • mobile/src/modules/customization/theme/components/OpacitySlider.tsx
  • mobile/src/modules/customization/theme/core/utils.ts
  • mobile/src/modules/customization/theme/helpers/colorConverter.ts
  • mobile/src/modules/customization/theme/hooks.ts
  • mobile/src/modules/customization/theme/utils.ts
  • mobile/src/navigation/screens/HomeView.tsx
  • mobile/src/navigation/screens/settings/AppUpdateView.tsx
  • mobile/src/resources/licenses.json
  • mobile/src/utils/color.ts
Files with no reviewable changes: 1

  • mobile/src/modules/customization/theme/helpers/colorConverter.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@cyanChill
cyanChill merged commit 9fd5bbf into dev Nov 12, 2026
1 check passed
@cyanChill
cyanChill deleted the feat/colord branch November 12, 2026 02:37
cyanChill added a commit that referenced this pull request Nov 14, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Dec 3, 2026
3 of 5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Housekeeping Code maintenance or refactor.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant