MCPcopy Create free account
hub / github.com/Noumena-Network/code / colorToString

Function colorToString

src/ink/Ansi.tsx:235–246  ·  view source on GitHub ↗

* Convert termio's Color to the string format used by Ink.

(color: TermioColor)

Source from the content-addressed store, hash-verified

233 * Convert termio's Color to the string format used by Ink.
234 */
235function colorToString(color: TermioColor): Color | undefined {
236 switch (color.type) {
237 case 'named':
238 return NAMED_COLOR_MAP[color.name] as Color;
239 case 'indexed':
240 return `ansi256(${color.index})` as Color;
241 case 'rgb':
242 return `rgb(${color.r},${color.g},${color.b})` as Color;
243 case 'default':
244 return undefined;
245 }
246}
247
248/**
249 * Check if two SpanProps are equal for merging.

Callers 1

textStyleToSpanPropsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected