module HSLuv

Overview

HSLuv is a perceptually uniform colorspace.

Extended Modules

Defined in:

hsluv.cr

Constant Summary

EPSILON = 0.0088564516
KAPPA = 903.2962962
M = Matrix[FloatVec[3.240969941904521, -1.537383177570093, -0.498610760293], FloatVec[-0.96924363628087, 1.87596750150772, 0.041555057407175], FloatVec[0.055630079696993, -0.20397695888897, 1.056971514242878]]
M_INV = Matrix[FloatVec[0.41239079926595, 0.35758433938387, 0.18048078840183], FloatVec[0.21263900587151, 0.71516867876775, 0.072192315360733], FloatVec[0.019330818715591, 0.11919477979462, 0.95053215224966]]
REF_U = 0.19783000664283
REF_V = 0.46831999493879
REF_Y = 1.0
VERSION = "0.1.0"

Instance Method Summary

Instance Method Detail

def distance_from_pole(point) : Float64 #

[View source]
def dot_product(a, b) : Float64 #

[View source]
def f(t) : Float64 #

[View source]
def f_inv(t) : Float64 #

[View source]
def from_linear(c) : Float64 #

[View source]
def get_bounds(l) : Array(Array(Float64)) #

[View source]
def hex_to_hpluv(hex : String) : FloatVec #

Converts a hexadecimal string to an HPLuv hsl array.


[View source]
def hex_to_hsluv(hex : String) : FloatVec #

Converts a hexadecimal string to HSLuv, in h, s, l order


[View source]
def hex_to_rgb(hex : String) : FloatVec #

Converts a hex color string to an rgb array


[View source]
def hpluv_to_hex(h : Float64, s : Float64, l : Float64) : String #

Converts an HPLuv color to a hexadecimal string.


[View source]
def hpluv_to_lch(arr) : FloatVec #

[View source]
def hpluv_to_rgb(h : Float64, s : Float64, l : Float64) : FloatVec #

Converts an HPLuv hsl color to an rgb array.


[View source]
def hsluv_to_hex(h : Float64, s : Float64, l : Float64) : String #

Converts an HSLuv color to a hexadecimal string.


[View source]
def hsluv_to_lch(arr) : FloatVec #

[View source]
def hsluv_to_rgb(h : Float64, s : Float64, l : Float64) : FloatVec #

Converts an HSLuv color to an rgb array.


[View source]
def intersect_line_line(line1, line2) : Float64 #

[View source]
def lch_to_hpluv(arr) : FloatVec #

[View source]
def lch_to_hsluv(arr) : FloatVec #

[View source]
def lch_to_luv(arr) : FloatVec #

[View source]
def lch_to_rgb(l : Float64, c : Float64, h : Float64) : FloatVec #

Converts an LCh color to an rgb array.


[View source]
def length_of_ray_until_intersect(theta, line) #

[View source]
def luv_to_lch(arr) : FloatVec #

[View source]
def luv_to_xyz(arr) : FloatVec #

[View source]
def max_chroma_for(l, h) : Float64 #

[View source]
def max_safe_chroma_for(l) : Float64 #

[View source]
def rgb_prepare(arr) : StaticArray(Int32, 3) #

Scales, clamps, and rounds an rgb color array from [0, 1] to [0, 255]


[View source]
def rgb_to_hex(r : Float64, g : Float64, b : Float64) : String #

Converts an rgb color to a hex color code - e.g. rgb_to_hex(0xff, 0xaa, 0x88) == "#ffaa88"


[View source]
def rgb_to_hpluv(r : Float64, g : Float64, b : Float64) : FloatVec #

Converts an rgb color to an HPLuv hsl array.


[View source]
def rgb_to_hsluv(r : Float64, g : Float64, b : Float64) : FloatVec #

Converts an rgb color to an HSLuv hsl array.


[View source]
def rgb_to_lch(r : Float64, g : Float64, b : Float64) : FloatVec #

Converts an rgb color to an LCh array.


[View source]
def rgb_to_xyz(arr : FloatVec) : FloatVec #

Converts an rgb array to an xyz color array.


[View source]
def to_linear(c) : Float64 #

[View source]
def xyz_to_luv(arr) : FloatVec #

[View source]
def xyz_to_rgb(arr) : FloatVec #

[View source]