colorsys
Convert between RGB, YIQ, HLS, and HSV color systems.
Summary
| Latest Version | Unknown |
|---|---|
| License | MIT |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-07-21 05:23 |
Tags
Installation
nimble install colorsys
choosenim install colorsys
git clone https://github.com/achesak/nim-colorsys
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| colorsys | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Source
| Repository | https://github.com/achesak/nim-colorsys |
|---|---|
| Homepage | https://github.com/achesak/nim-colorsys |
| Registry Source | nimble_official |
README
About
nim-colorsys is a Nim module for converting between the RGB, YIQ, HLS, and HSV color systems. It is a port of the colorsys module in the Python standard library.
All coordinates used are floats, between 0 and 1 (the exception being I and Q in the YIQ color space, which can be positive or negative).
Example:
# Gold color
var rgb : seq[float] = @[1.00, 0.84, 0.00]
# Convert to other color systems.
var yiq : seq[float] = rgbToYiq(rgb)
var hls : seq[float] = rgbToHls(rgb)
var hsv : seq[float] = rgbToHsv(rgb)
# Output the color in each system.
echo("RGB: " & $rgb) # outputs "RGB: @[1.0, 0.84, 0.0]"
echo("YIQ: " & $yiq) # outputs "YIQ: @[0.7955999999999999, 0.3648, -0.2268]"
echo("HLS: " & $hls) # outputs "HLS: @[0.14, 0.5, 1.0]"
echo("HSV: " & $hsv) # outputs "HSV: @[0.14, 1.0, 1.0]"
Example based on Python colorsys example at http://effbot.org/librarybook/colorsys.htm.
License
nim-colorsys is released under the MIT open source license.