diff --git a/src/rt/shell/color.ts b/src/rt/shell/color.ts index a186897..1c3fe2b 100644 --- a/src/rt/shell/color.ts +++ b/src/rt/shell/color.ts @@ -7,20 +7,23 @@ const enum Colors { cyan = "cyan", bold = "bold" } -function newcolor(inner: string, color?: Colors) { +function newcolor(inner: string, color?: Colors, bold?: boolean) { const span = create("span", color) span.innerText = inner + if (bold) { + span.className = color ? color+" bold" : "bold" + } return span } -const red = (s: string) => newcolor(s, Colors.red ) -const green = (s: string) => newcolor(s, Colors.green) -const blue = (s: string) => newcolor(s, Colors.blue) -const cyan = (s: string) => newcolor(s, Colors.cyan) -const bold = (s: string) => newcolor(s, Colors.bold) +const red = (s: string, bold?: boolean) => newcolor(s, Colors.red, bold) +const green = (s: string, bold?: boolean) => newcolor(s, Colors.green, bold) +const blue = (s: string, bold?: boolean) => newcolor(s, Colors.blue, bold) +const cyan = (s: string, bold?: boolean) => newcolor(s, Colors.cyan, bold) +const bold = (s: string) => newcolor(s, Colors.bold) -export default function rgb(s: string, Ru8: number, Gu8: number, Bu8: number) { - const rgb_span = newcolor(s) +export default function rgb(s: string, Ru8: number, Gu8: number, Bu8: number, bold?: boolean) { + const rgb_span = newcolor(s, undefined, bold) rgb_span.style.color = `rgb(${Ru8},${Gu8},${Bu8})` return rgb_span }