cup/colors.nim

18 lines
338 B
Nim
Raw Normal View History

type
Color* = enum
cRed, cGreen, cBlue, cYellow, cPurple
const
colorNames: array[Color, string] =
["Red", "Green", "Blue", "Yellow", "Purple"]
colorAbbrevs: array[Color, char] = ['R', 'G', 'B', 'Y', 'P']
proc `$`*(c: Color): string =
result = colorNames[c]
proc abbrev*(c: Color): char =
result = colorAbbrevs[c]