mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-24 14:45:36 +00:00
## Summary Consolidate duplicate `rgbToHSL` implementation — mask editor now uses the shared `colorUtil.ts` version instead of its own copy. ## Changes - Export `rgbToHsl` from `src/utils/colorUtil.ts` (was private) - Replace 30-line local `rgbToHSL` in `useCanvasTools.ts` with a 2-line wrapper that imports from `colorUtil.ts` and scales the return values from 0-1 to degree/percentage ## Testing ### Automated - All 176 existing tests pass (`colorUtil.test.ts` + `maskeditor/` suite) - No new tests needed — behavior is identical ### E2E Verification Steps 1. Open any image in the mask editor 2. Select the magic wand / color picker tool 3. Use HSL-based color matching — results should be identical to before ## Review Focus The canonical `rgbToHsl` returns normalized 0-1 values while the mask editor needs degree/percentage scale (h: 0-360, s: 0-100, l: 0-100). The local wrapper handles this conversion. Fixes #11080 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-11134-chore-11080-consolidate-duplicate-rgbToHSL-use-shared-colorUtil-33e6d73d36508120bbd8f444f5cc94b6) by [Unito](https://www.unito.io) Co-authored-by: Terry Jia <terryjia88@gmail.com>