lygia
/v1.1.6
/color
/space
/rgb2lab
)Converts a RGB color to Lab color space.
Dependencies:
Use:
rgb2lab(<vec3|vec4> color)
#ifndef FNC_RGB2LAB
#define FNC_RGB2LAB
vec3 rgb2lab(in vec3 c) {
vec3 lab = xyz2lab( rgb2xyz( c ) );
return vec3(lab.x / 100.0,
0.5 + 0.5 * (lab.y / 127.0),
0.5 + 0.5 * (lab.z / 127.0));
}
vec4 rgb2lab(in vec4 rgb) { return vec4(rgb2lab(rgb.rgb),rgb.a); }
#endif
Dependencies:
Use:
rgb2lab(<float3|float4> color)
#ifndef FNC_RGB2LAB
#define FNC_RGB2LAB
float3 rgb2lab(in float3 c) {
float3 lab = xyz2lab( rgb2xyz( c ) );
return float3( lab.x / 100.0,
0.5 + 0.5 * (lab.y / 127.0),
0.5 + 0.5 * (lab.z / 127.0));
}
float4 rgb2lab(in float4 rgb) { return float4(rgb2lab(rgb.rgb),rgb.a); }
#endif
Dependencies:
fn rgb2lab(c: vec3<f32> ) -> vec3<f32> {
let lab = xyz2lab(rgb2xyz(c));
return vec3<f32>( lab.x / 100.0,
0.5 + 0.5 * (lab.y / 127.0),
0.5 + 0.5 * (lab.z / 127.0));
}
LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.
Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).
It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.
Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository