* Convert termio's TextStyle to SpanProps.
(style: TextStyle)
| 195 | * Convert termio's TextStyle to SpanProps. |
| 196 | */ |
| 197 | function 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 |
| 213 | const NAMED_COLOR_MAP: Record<NamedColor, string> = { |
no test coverage detected