Compare commits
2 Commits
f8cddaf340
...
86982c9b96
Author | SHA1 | Date | |
---|---|---|---|
86982c9b96 | |||
45cc88953b |
@ -7,20 +7,23 @@ const enum Colors {
|
|||||||
cyan = "cyan",
|
cyan = "cyan",
|
||||||
bold = "bold"
|
bold = "bold"
|
||||||
}
|
}
|
||||||
function newcolor(inner: string, color?: Colors) {
|
function newcolor(inner: string, color?: Colors, bold?: boolean) {
|
||||||
const span = create("span", color)
|
const span = create("span", color)
|
||||||
span.innerText = inner
|
span.innerText = inner
|
||||||
|
if (bold) {
|
||||||
|
span.className = color ? color+" bold" : "bold"
|
||||||
|
}
|
||||||
return span
|
return span
|
||||||
}
|
}
|
||||||
|
|
||||||
const red = (s: string) => newcolor(s, Colors.red )
|
const red = (s: string, bold?: boolean) => newcolor(s, Colors.red, bold)
|
||||||
const green = (s: string) => newcolor(s, Colors.green)
|
const green = (s: string, bold?: boolean) => newcolor(s, Colors.green, bold)
|
||||||
const blue = (s: string) => newcolor(s, Colors.blue)
|
const blue = (s: string, bold?: boolean) => newcolor(s, Colors.blue, bold)
|
||||||
const cyan = (s: string) => newcolor(s, Colors.cyan)
|
const cyan = (s: string, bold?: boolean) => newcolor(s, Colors.cyan, bold)
|
||||||
const bold = (s: string) => newcolor(s, Colors.bold)
|
const bold = (s: string) => newcolor(s, Colors.bold)
|
||||||
|
|
||||||
export default function rgb(s: string, Ru8: number, Gu8: number, Bu8: number) {
|
export default function rgb(s: string, Ru8: number, Gu8: number, Bu8: number, bold?: boolean) {
|
||||||
const rgb_span = newcolor(s)
|
const rgb_span = newcolor(s, undefined, bold)
|
||||||
rgb_span.style.color = `rgb(${Ru8},${Gu8},${Bu8})`
|
rgb_span.style.color = `rgb(${Ru8},${Gu8},${Bu8})`
|
||||||
return rgb_span
|
return rgb_span
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user