mirror of
https://github.com/catppuccin/nim.git
synced 2024-11-10 03:43:14 -06:00
29 lines
515 B
Nim
29 lines
515 B
Nim
|
import std/[strformat]
|
||
|
import catppuccin
|
||
|
|
||
|
const ansiReset = "\e[0m"
|
||
|
|
||
|
proc ansi(s: string, c: ColorRGB): string =
|
||
|
let code = &"\e[48;2;{c.r};{c.g};{c.b}m"
|
||
|
result.add(code)
|
||
|
result.add(s)
|
||
|
result.add(ansiReset)
|
||
|
|
||
|
|
||
|
when isMainModule:
|
||
|
let flavors = @[
|
||
|
("latte", latte),
|
||
|
("frappe", frappe),
|
||
|
("macchiato", macchiato),
|
||
|
("mocha", mocha)
|
||
|
]
|
||
|
|
||
|
for (name, flavor) in flavors:
|
||
|
|
||
|
echo name
|
||
|
|
||
|
for name, color in flavor.fieldPairs():
|
||
|
write(stdout, " ".ansi(color))
|
||
|
|
||
|
write(stdout, "\n\n")
|