Module colors

This module implements color handling for Nimrod. It is used by the graphics module.

Types

TColor* = distinct int
a color stored as RGB

Consts

colAliceBlue* = TColor(0x00F0F8FF)
colAntiqueWhite* = TColor(0x00FAEBD7)
colAqua* = TColor(0x0000FFFF)
colAquamarine* = TColor(0x007FFFD4)
colAzure* = TColor(0x00F0FFFF)
colBeige* = TColor(0x00F5F5DC)
colBisque* = TColor(0x00FFE4C4)
colBlack* = TColor(0x00000000)
colBlanchedAlmond* = TColor(0x00FFEBCD)
colBlue* = TColor(0x000000FF)
colBlueViolet* = TColor(0x008A2BE2)
colBrown* = TColor(0x00A52A2A)
colBurlyWood* = TColor(0x00DEB887)
colCadetBlue* = TColor(0x005F9EA0)
colChartreuse* = TColor(0x007FFF00)
colChocolate* = TColor(0x00D2691E)
colCoral* = TColor(0x00FF7F50)
colCornflowerBlue* = TColor(0x006495ED)
colCornsilk* = TColor(0x00FFF8DC)
colCrimson* = TColor(0x00DC143C)
colCyan* = TColor(0x0000FFFF)
colDarkBlue* = TColor(0x0000008B)
colDarkCyan* = TColor(0x00008B8B)
colDarkGoldenRod* = TColor(0x00B8860B)
colDarkGray* = TColor(0x00A9A9A9)
colDarkGreen* = TColor(0x00006400)
colDarkKhaki* = TColor(0x00BDB76B)
colDarkMagenta* = TColor(0x008B008B)
colDarkOliveGreen* = TColor(0x00556B2F)
colDarkorange* = TColor(0x00FF8C00)
colDarkOrchid* = TColor(0x009932CC)
colDarkRed* = TColor(0x008B0000)
colDarkSalmon* = TColor(0x00E9967A)
colDarkSeaGreen* = TColor(0x008FBC8F)
colDarkSlateBlue* = TColor(0x00483D8B)
colDarkSlateGray* = TColor(0x002F4F4F)
colDarkTurquoise* = TColor(0x0000CED1)
colDarkViolet* = TColor(0x009400D3)
colDeepPink* = TColor(0x00FF1493)
colDeepSkyBlue* = TColor(0x0000BFFF)
colDimGray* = TColor(0x00696969)
colDodgerBlue* = TColor(0x001E90FF)
colFireBrick* = TColor(0x00B22222)
colFloralWhite* = TColor(0x00FFFAF0)
colForestGreen* = TColor(0x00228B22)
colFuchsia* = TColor(0x00FF00FF)
colGainsboro* = TColor(0x00DCDCDC)
colGhostWhite* = TColor(0x00F8F8FF)
colGold* = TColor(0x00FFD700)
colGoldenRod* = TColor(0x00DAA520)
colGray* = TColor(0x00808080)
colGreen* = TColor(0x00008000)
colGreenYellow* = TColor(0x00ADFF2F)
colHoneyDew* = TColor(0x00F0FFF0)
colHotPink* = TColor(0x00FF69B4)
colIndianRed* = TColor(0x00CD5C5C)
colIndigo* = TColor(0x004B0082)
colIvory* = TColor(0x00FFFFF0)
colKhaki* = TColor(0x00F0E68C)
colLavender* = TColor(0x00E6E6FA)
colLavenderBlush* = TColor(0x00FFF0F5)
colLawnGreen* = TColor(0x007CFC00)
colLemonChiffon* = TColor(0x00FFFACD)
colLightBlue* = TColor(0x00ADD8E6)
colLightCoral* = TColor(0x00F08080)
colLightCyan* = TColor(0x00E0FFFF)
colLightGoldenRodYellow* = TColor(0x00FAFAD2)
colLightGrey* = TColor(0x00D3D3D3)
colLightGreen* = TColor(0x0090EE90)
colLightPink* = TColor(0x00FFB6C1)
colLightSalmon* = TColor(0x00FFA07A)
colLightSeaGreen* = TColor(0x0020B2AA)
colLightSkyBlue* = TColor(0x0087CEFA)
colLightSlateGray* = TColor(0x00778899)
colLightSteelBlue* = TColor(0x00B0C4DE)
colLightYellow* = TColor(0x00FFFFE0)
colLime* = TColor(0x0000FF00)
colLimeGreen* = TColor(0x0032CD32)
colLinen* = TColor(0x00FAF0E6)
colMagenta* = TColor(0x00FF00FF)
colMaroon* = TColor(0x00800000)
colMediumAquaMarine* = TColor(0x0066CDAA)
colMediumBlue* = TColor(0x000000CD)
colMediumOrchid* = TColor(0x00BA55D3)
colMediumPurple* = TColor(0x009370D8)
colMediumSeaGreen* = TColor(0x003CB371)
colMediumSlateBlue* = TColor(0x007B68EE)
colMediumSpringGreen* = TColor(0x0000FA9A)
colMediumTurquoise* = TColor(0x0048D1CC)
colMediumVioletRed* = TColor(0x00C71585)
colMidnightBlue* = TColor(0x00191970)
colMintCream* = TColor(0x00F5FFFA)
colMistyRose* = TColor(0x00FFE4E1)
colMoccasin* = TColor(0x00FFE4B5)
colNavajoWhite* = TColor(0x00FFDEAD)
colNavy* = TColor(0x00000080)
colOldLace* = TColor(0x00FDF5E6)
colOlive* = TColor(0x00808000)
colOliveDrab* = TColor(0x006B8E23)
colOrange* = TColor(0x00FFA500)
colOrangeRed* = TColor(0x00FF4500)
colOrchid* = TColor(0x00DA70D6)
colPaleGoldenRod* = TColor(0x00EEE8AA)
colPaleGreen* = TColor(0x0098FB98)
colPaleTurquoise* = TColor(0x00AFEEEE)
colPaleVioletRed* = TColor(0x00D87093)
colPapayaWhip* = TColor(0x00FFEFD5)
colPeachPuff* = TColor(0x00FFDAB9)
colPeru* = TColor(0x00CD853F)
colPink* = TColor(0x00FFC0CB)
colPlum* = TColor(0x00DDA0DD)
colPowderBlue* = TColor(0x00B0E0E6)
colPurple* = TColor(0x00800080)
colRed* = TColor(0x00FF0000)
colRosyBrown* = TColor(0x00BC8F8F)
colRoyalBlue* = TColor(0x004169E1)
colSaddleBrown* = TColor(0x008B4513)
colSalmon* = TColor(0x00FA8072)
colSandyBrown* = TColor(0x00F4A460)
colSeaGreen* = TColor(0x002E8B57)
colSeaShell* = TColor(0x00FFF5EE)
colSienna* = TColor(0x00A0522D)
colSilver* = TColor(0x00C0C0C0)
colSkyBlue* = TColor(0x0087CEEB)
colSlateBlue* = TColor(0x006A5ACD)
colSlateGray* = TColor(0x00708090)
colSnow* = TColor(0x00FFFAFA)
colSpringGreen* = TColor(0x0000FF7F)
colSteelBlue* = TColor(0x004682B4)
colTan* = TColor(0x00D2B48C)
colTeal* = TColor(0x00008080)
colThistle* = TColor(0x00D8BFD8)
colTomato* = TColor(0x00FF6347)
colTurquoise* = TColor(0x0040E0D0)
colViolet* = TColor(0x00EE82EE)
colWheat* = TColor(0x00F5DEB3)
colWhite* = TColor(0x00FFFFFF)
colWhiteSmoke* = TColor(0x00F5F5F5)
colYellow* = TColor(0x00FFFF00)
colYellowGreen* = TColor(0x009ACD32)

Procs

proc `==`*(a, b: TColor): bool {.borrow.}
compares two colors.
proc `+`*(a, b: TColor): TColor
adds two colors: This uses saturated artithmetic, so that each color component cannot overflow (255 is used as a maximum).
proc `-`*(a, b: TColor): TColor
substracts two colors: This uses saturated artithmetic, so that each color component cannot overflow (255 is used as a maximum).
proc extractRGB*(a: TColor): tuple[r, g, b: range[0 .. 255]]
extracts the red/green/blue components of the color a.
proc intensity*(a: TColor; f: float): TColor
returns a with intensity f. f should be a float from 0.0 (completely dark) to 1.0 (full color intensity).
proc `$`*(c: TColor): string
converts a color into its textual representation. Example: #00FF00.
proc parseColor*(name: string): TColor
parses name to a color value. If no valid color could be parsed EInvalidValue is raised.
proc isColor*(name: string): bool
returns true if name is a known color name or a hexadecimal color prefixed with #.
proc rgb*(r, g, b: range[0 .. 255]): TColor
constructs a color from RGB values.

Templates

template mix*(a, b: TColor; fn: expr): expr
uses fn to mix the colors a and b. fn is invoked for each component R, G, and B. This is a template because fn should be inlined and the compiler cannot inline proc pointers yet. If fn's result is not in the range[0..255], it will be saturated to be so.
Generated: 2012-09-23 21:47:54 UTC