import Ansi from './ansi.ts'; import { SCROLL_COLOR_SCHEME } from './config.ts'; /** * The type of Syntax being highlighted */ export enum HighlightType { /** No highlighting */ None, /** Number literals */ Number, /** Search results */ Match, /** Character literals */ Character, /** String literals */ String, /** Single line comments */ SingleLineComment, /** Multi-line comments */ MultiLineComment, /** Primary keywords */ Keyword1, /** Secondary keywords */ Keyword2, /** Math/logic operators */ Operator, } /** * Return the configured ANSI formatting escape codes for the * type of syntax specified * * @param type The type of syntax to highlight */ export function highlightToColor(type: HighlightType): string { return SCROLL_COLOR_SCHEME.get(type) ?? Ansi.ResetFormatting; }