Skip to content

Allow string color types #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 28, 2025
Merged

Allow string color types #117

merged 1 commit into from
Apr 28, 2025

Conversation

marklundin
Copy link
Member

@marklundin marklundin commented Apr 28, 2025

This PR broaden the color type of components to support string. Closes #110

  • Removed unused type definitions related to CSS colors in color.ts.
  • Updated the Serializable type in types-utils.ts to replace CssColor with string for better type consistency.

These changes streamline the color utility functions and enhance type safety across the codebase.

- Removed unused type definitions related to CSS colors in color.ts.
- Updated the Serializable type in types-utils.ts to replace CssColor with string for better type consistency.

These changes streamline the color utility functions and enhance type safety across the codebase.
@marklundin marklundin requested a review from Copilot April 28, 2025 14:36
@marklundin marklundin self-assigned this Apr 28, 2025
@marklundin marklundin added the enhancement New feature or request label Apr 28, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR broadens the color type support for components by replacing the internal CssColor type with string, streamlining color utility functions and improving type consistency.

  • Removed unused CSS color type definitions in color.ts.
  • Updated the Serializable type in types-utils.ts to use string for color values.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/lib/src/utils/types-utils.ts Replaced CssColor with string in the Serializable type definition.
packages/lib/src/utils/color.ts Removed unused CSS color-related type definitions and commented code.
Comments suppressed due to low confidence (1)

packages/lib/src/utils/types-utils.ts:38

  • Ensure that replacing CssColor with string does not impact color value validation or formatting expectations in other parts of the codebase.
[K in keyof T]: T[K] extends Color ? string :

Copy link

pkg-pr-new bot commented Apr 28, 2025

Open in StackBlitz

npm i https://pkg.pr.new/playcanvas/react/@playcanvas/react@117

commit: 6dbf196

@marklundin marklundin merged commit e73fb35 into main Apr 28, 2025
5 checks passed
@marklundin marklundin deleted the feat-loose-colors branch April 28, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export Colour Types
1 participant