ansiStyle(spec: string): string
One style spec as an SGR prefix — fg=yellow, fg=8, fg=#e5c07b, fg=red,bold.
The three colour spellings are the three that turn up in the wild: a name, which the terminal resolves against its own theme; a 256-colour index; and a truecolour triple. Anything it cannot read styles nothing, because a prompt that refuses to draw over a typo in an environment variable is worse than one that draws plainly.
import { ansiStyle } from './theme.ts'; ansiStyle('fg=yellow').endsWith('[33m'); // true ansiStyle('fg=#585858').endsWith('[38;2;88;88;88m'); // true ansiStyle('nonsense'); // '' — unreadable is unstyled