MCPcopy Create free account
hub / github.com/codeaashu/claude-code / resolveColor

Function resolveColor

src/components/design-system/ThemedText.tsx:66–74  ·  view source on GitHub ↗

* Resolves a color value that may be a theme key to a raw Color.

(color: keyof Theme | Color | undefined, theme: Theme)

Source from the content-addressed store, hash-verified

64 * Resolves a color value that may be a theme key to a raw Color.
65 */
66function resolveColor(color: keyof Theme | Color | undefined, theme: Theme): Color | undefined {
67 if (!color) return undefined;
68 // Check if it's a raw color (starts with rgb(, #, ansi256(, or ansi:)
69 if (color.startsWith('rgb(') || color.startsWith('#') || color.startsWith('ansi256(') || color.startsWith('ansi:')) {
70 return color as Color;
71 }
72 // It's a theme key - resolve it
73 return theme[color as keyof Theme] as Color;
74}
75
76/**
77 * Theme-aware Text component that resolves theme color keys to raw colors.

Callers 1

ThemedTextFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected