18 lines
338 B
Nim
18 lines
338 B
Nim
|
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]
|