MCPcopy Create free account
hub / github.com/Snapchat/Valdi / escapeAnsiColor

Function escapeAnsiColor

valdi/vscode_debugger/src/adapter/messageFormat.ts:114–124  ·  view source on GitHub ↗
(colorString: string)

Source from the content-addressed store, hash-verified

112}
113
114function 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
126export function formatCssAsAnsi(style: string): string {
127 const cssRegex = /\s*(.*?)\s*:\s*(.*?)\s*(?:;|$)/g;

Callers 1

formatCssAsAnsiFunction · 0.85

Calls 1

objectMethod · 0.80

Tested by

no test coverage detected