* Convert termio's Color to the string format used by Ink.
(color: TermioColor)
| 233 | * Convert termio's Color to the string format used by Ink. |
| 234 | */ |
| 235 | function 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. |
no outgoing calls
no test coverage detected