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

Function textStyleToSpanProps

src/ink/Ansi.tsx:197–210  ·  view source on GitHub ↗

* Convert termio's TextStyle to SpanProps.

(style: TextStyle)

Source from the content-addressed store, hash-verified

195 * Convert termio's TextStyle to SpanProps.
196 */
197function textStyleToSpanProps(style: TextStyle): SpanProps {
198 const props: SpanProps = {};
199 if (style.bold) props.bold = true;
200 if (style.dim) props.dim = true;
201 if (style.italic) props.italic = true;
202 if (style.underline !== 'none') props.underline = true;
203 if (style.strikethrough) props.strikethrough = true;
204 if (style.inverse) props.inverse = true;
205 const fgColor = colorToString(style.fg);
206 if (fgColor) props.color = fgColor;
207 const bgColor = colorToString(style.bg);
208 if (bgColor) props.backgroundColor = bgColor;
209 return props;
210}
211
212// Map termio named colors to the ansi: format
213const NAMED_COLOR_MAP: Record<NamedColor, string> = {

Callers 1

parseToSpansUncachedFunction · 0.85

Calls 1

colorToStringFunction · 0.85

Tested by

no test coverage detected