Colorsys.jl is a Julia package(or lib) for everyone to transform one color system to another. The transformation is among RGB, YIQ, HLS and HSV.
import Pkg
Pkg.clone("https://github.com/cckuailong/Colorsys.jl.git")
using Colorsys
All inputs and outputs are three floats in the range [0.0...1.0] (with the exception of I and Q, which covers a slightly larger range also with the exception of R, G and B, which range from 0 to 255 also with the exception of H, which range from 0 to 360).
range of each parameter
R, G, B : 0 ~ 255
I, Q : -1 ~ 1.X
H : 0 ~ 360
Y, S, V, L : 0 ~ 1
- RGB to YIQ
y, i, q = rgb2yiq(r, g, b)
- YIQ to RGB
r, g, b = yiq2rgb(y, i, q)
- RGB to HLS
h, l, s = rgb2hls(r, g, b)
- HLS to RGB
r, g, b = hls2rgb(h, l, s)
- RGB to HSV
h, s, v = rgb2hsv(r, g, b)
- HSV to RGB
r, g, b = hsv2rgb(h, s, v)
- Yiq to Hls
h, l, s = yiq2hls(y, i, q)
- YIQ to HSV
h, s, v = yiq2hsv(y, i, q)
- HLS to YIQ
y, i, q = hls2yiq(h, l, s)
- HLS to HSV
h, s, v = hls2hsv(h, l, s)
- HSV to YIQ
y, i, q = hsv2yiq(h, s, v)
- HSV to HLS
h, l, s = hsv2hls(h, s, v)
Any questions, welcome to email me at 346813862Hjj@gmail.com
My Blog is lovebear.top