-
-
Notifications
You must be signed in to change notification settings - Fork 658
Open
Description
Description
The Color class methods for parsing and serializing color values could benefit from memoization to avoid redundant computation:
Parsing (cache by input):
parseRGB()— parses "rgb(...)" / "rgba(...)" stringsparseHex()— parses "#RRGGBB" / "#RRGGBBAA" hex strings
Serialization (cache by r,g,b,a state, invalidate on change):
toHex()— returns "#RRGGBB"toHex8()— returns "#RRGGBBAA"toRGB()— returns "rgb(R,G,B)"toRGBA()— returns "rgba(R,G,B,A)"
For serialization, the cache should be invalidated whenever r, g, b, or a values change (e.g. via setColor, parseHex, etc.).
Context
These were tracked as inline TODO comments in src/math/color.ts. Moved to a ticket for better visibility and tracking.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels