* Convert termio's TextStyle to SpanProps.
(style: TextStyle)
| 156 | * Convert termio's TextStyle to SpanProps. |
| 157 | */ |
| 158 | function textStyleToSpanProps(style: TextStyle): SpanProps { |
| 159 | const props: SpanProps = {}; |
| 160 | if (style.bold) props.bold = true; |
| 161 | if (style.dim) props.dim = true; |
| 162 | if (style.italic) props.italic = true; |
| 163 | if (style.underline !== 'none') props.underline = true; |
| 164 | if (style.strikethrough) props.strikethrough = true; |
| 165 | if (style.inverse) props.inverse = true; |
| 166 | const fgColor = colorToString(style.fg); |
| 167 | if (fgColor) props.color = fgColor; |
| 168 | const bgColor = colorToString(style.bg); |
| 169 | if (bgColor) props.backgroundColor = bgColor; |
| 170 | return props; |
| 171 | } |
| 172 | |
| 173 | // Map termio named colors to the ansi: format |
| 174 | const NAMED_COLOR_MAP: Record<NamedColor, string> = { |
no test coverage detected