(colorString: string)
| 112 | } |
| 113 | |
| 114 | function escapeAnsiColor(colorString: string): number | undefined { |
| 115 | try { |
| 116 | // Color can parse hex and color names |
| 117 | const color = new Color(colorString); |
| 118 | return color.ansi256().object().ansi256; |
| 119 | } catch (ex) { |
| 120 | // Unable to parse Color |
| 121 | // For instance, "inherit" color will throw |
| 122 | } |
| 123 | return undefined; |
| 124 | } |
| 125 | |
| 126 | export function formatCssAsAnsi(style: string): string { |
| 127 | const cssRegex = /\s*(.*?)\s*:\s*(.*?)\s*(?:;|$)/g; |
no test coverage detected