consolidating rgb & hsl formats#45
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR consolidates legacy rgba/hsla handling into the existing rgb/hsl formats, keeping input compatibility while standardizing output on modern CSS syntax.
Changes:
- Removed
rgbaandhslafromcolorTypesand updated type detection/validation to treat them as aliases ofrgb/hsl. - Updated
translatedColorto emit modernrgb(... / alpha)andhsl(... / alpha)syntax (and updated tests accordingly). - Removed
rgba/hslainputs from the UI.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/typeOfColor.ts | Stops returning distinct rgba/hsla types; classifies them as rgb/hsl. |
| src/utils/typeOfColor.test.ts | Updates expectations so rgba/hsla map to rgb/hsl. |
| src/utils/translatedColor.ts | Removes rgba/hsla targets and emits modern rgb/hsl alpha syntax. |
| src/utils/translatedColor.test.ts | Reworks translation tests to match consolidated types and modern output. |
| src/utils/isValidColor.ts | Drops isValidRgba/isValidHsla; accepts legacy aliases in isValidRgb/isValidHsl. |
| src/utils/isValidColor.test.ts | Removes rgba/hsla validator tests; adds alias coverage under rgb/hsl validators. |
| src/utils/colorTypes.ts | Removes rgba and hsla enum members. |
| src/App.tsx | Removes dedicated rgba and hsla input fields from the UI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR removes the separate rgba & hsla color types - as they are now functionally equivelant to rgb & hsl. In fact, MDN recommends using
rgbandhslonly. The input will still accept rgba & hsla, but output will always be the modern syntax.