Everything you want to do with colors.
Procs
proc almostEqual(a, b: Color; ep = 0.01): bool {....raises: [], tags: [], forbids: [].}
- Returns true if colors are close Source Edit
proc desaturate(color: Color; amount: float32): Color {....raises: [], tags: [], forbids: [].}
- Desaturate (makes grayer) the color by amount 0-1. Source Edit
func hash(c: Color): Hash {....raises: [], tags: [], forbids: [].}
- Hashes a Color - used in tables. Source Edit
func hash(c: ColorCMY): Hash {....raises: [], tags: [], forbids: [].}
- Hashes a ColorCMY - used in tables. Source Edit
func hash(c: ColorCMYK): Hash {....raises: [], tags: [], forbids: [].}
- Hashes a ColorCMYK - used in tables. Source Edit
func hash(c: ColorHSL): Hash {....raises: [], tags: [], forbids: [].}
- Hashes a ColorHSL - used in tables. Source Edit
func hash(c: ColorHSV): Hash {....raises: [], tags: [], forbids: [].}
- Hashes a ColorHSV - used in tables. Source Edit
func hash(c: ColorLAB): Hash {....raises: [], tags: [], forbids: [].}
- Hashes a ColorLAB - used in tables. Source Edit
func hash(c: ColorLUV): Hash {....raises: [], tags: [], forbids: [].}
- Hashes a ColorLUV - used in tables. Source Edit
func hash(c: ColorOklab): Hash {....raises: [], tags: [], forbids: [].}
- Hashes a ColorOklab - used in tables. Source Edit
func hash(c: ColorPolarLAB): Hash {....raises: [], tags: [], forbids: [].}
- Hashes a ColorPolarLAB - used in tables. Source Edit
func hash(c: ColorPolarLUV): Hash {....raises: [], tags: [], forbids: [].}
- Hashes a ColorPolarLUV - used in tables. Source Edit
func hash(c: ColorPolarOklab): Hash {....raises: [], tags: [], forbids: [].}
- Hashes a ColorOklab - used in tables. Source Edit
func hash(c: ColorRGB): Hash {....raises: [], tags: [], forbids: [].}
- Hashes a ColorRGB - used in tables. Source Edit
func hash(c: ColorRGBA): Hash {....raises: [], tags: [], forbids: [].}
- Hashes a ColorRGB - used in tables. Source Edit
proc mix(a, b: Color): Color {....raises: [], tags: [], forbids: [].}
- Mixes two Color colors together using simple average. Source Edit
proc mix(a, b: Color; v: float32): Color {....raises: [], tags: [], forbids: [].}
- Mixes two Color colors together using simple lerp. Source Edit
proc parseHexAlpha(hex: string): Color {....raises: [InvalidColor], tags: [], forbids: [].}
-
Parses colors like:
- FF0000FF -> red
- 0000FFFF -> blue
- FFFFFFFF -> white
- 000000FF -> opaque black
- 00000000 -> transparent black
proc parseHtmlColor(colorText: string): Color {. ...raises: [InvalidColor, ValueError, KeyError], tags: [], forbids: [].}
-
Parses HTML color any any of the formats:
- #FFF
- #FFFFFF
- rgb(255, 255, 255)
- rgba(255, 255, 255, 1.0)
- white
proc parseHtmlHex(hex: string): Color {....raises: [InvalidColor], tags: [], forbids: [].}
-
Parses colors with leading '#' like::
- #FF0000 -> red
- #0000ff -> blue
- #ffffff -> white
proc parseHtmlHexTiny(hex: string): Color {....raises: [InvalidColor], tags: [], forbids: [].}
-
Parses colors with leading '#' and 3 hex numbers like::
- #F00 -> red
- #0ff -> blue
- #fff -> white
proc parseHtmlName(text: string): Color {....raises: [InvalidColor, KeyError], tags: [], forbids: [].}
-
Parses HTML color as as a name:
- "red"
- "blue"
- "white"
- "amber"
- "Lavender Gray"
proc parseHtmlRgb(text: string): Color {....raises: [InvalidColor, ValueError], tags: [], forbids: [].}
-
Parses colors in html's rgb format:
- rgb(255, 0, 0) -> red
- rgb(0,0,255) -> blue
- rgb(255,255,255) -> white
proc parseHtmlRgba(text: string): Color {....raises: [InvalidColor, ValueError], tags: [], forbids: [].}
-
Parses colors in html's rgba format:
- rgba(255, 0, 0, 1.0) -> red
- rgba(0,0,255, 1.0) -> blue
- rgba(255,255,255, 1.0) -> white
- rgba(0,0,0,1.0) -> opaque black
- rgba(0,0,0,0.0) -> transparent black
Note: rgb is 0-255, while alpha is 0 to 1.
Source Edit proc toHexAlpha(c: Color): string {....raises: [], tags: [], forbids: [].}
-
Formats color as hex (upper case):
- red -> FF0000FF
- blue -> 0000FFFF
- white -> FFFFFFFF
- opaque black -> 000000FF
- transparent black -> 00000000
proc toHtmlHexTiny(c: Color): string {....raises: [], tags: [], forbids: [].}
-
Formats color as HTML 3 hex numbers (upper case):
- red -> #F00
- blue -> #00F
- white -> #FFF
proc toHtmlRgba(c: Color): string {....raises: [], tags: [], forbids: [].}
-
Parses colors in html's rgb format:
- red -> rgb(255, 0, 0)
- blue -> rgb(0,0,255)
- white -> rgb(255,255,255)
Exports
-
hsv, ColorHSV, rgbx, SomeColor, cmy, ColorRGBA, ColorOklab, ColorRGB, ColorRGBX, Color, ColorXYZ, hsl, ColorPolarOklab, ColorHSL, ColorLUV, rgb, ColorPolarLAB, xyz, ColorYUV, oklab, ColorHCL, InvalidColor, cmyk, ColorPolarLUV, lab, color, polarOklab, polarLAB, ColorLAB, ColorCMY, yuv, polarLUV, ColorCMYK, rgba, luv, deltaE00, fromTemperature, color, asColor, rgbx, color, rgba, color, polarOklab, rgbx, xyz, color, xyz, oklab, oklab, asCmyk, cmyk, asCmy, asRgbx, lab, to, polarLAB, asYuv, asPolarLuv, color, yuv, lab, rgba, uv, color, hsv, asHsv, color, color, cmy, lab, color, asRgba, color, asPolarOklab, polarLAB, kappa, asLuv, rgb, color, hsl, color, polarOklab, asRgb, polarLUV, color, asOklab, epsilon, color, rgbx, asLab, luv, f, asXyz, color, xyz, color, asPolarLAB, polarLUV, luv, asHsl, luv, blendExclusion, /, blendOverlay, blendScreen, -, blendHardLight, blendLinearBurn, blendLinearDodge, blendDarken, blendColorDodge, blendNormal, blendLighten, +, *, blendSaturation, -, blendColorBurn, blendMultiply, blendColor, blendHue, blendDifference, blendLuminosity, +, blendSoftLight