lygia
/color
/space
/lab2lch
)Converts a LCh to Lab color space. Note: LCh is simply Lab but converted to polar coordinates (in degrees).
Use:
<vec3|vec4> lab2rgb(<vec3|vec4> color)
#ifndef FNC_LAB2LCH
#define FNC_LAB2LCH
vec3 lab2lch(vec3 lab) {
return vec3(
lab.x,
sqrt(dot(lab.yz, lab.yz)),
atan(lab.z, lab.y) * 57.2957795131
);
}
vec4 lab2lch(vec4 lab) { return vec4(lab2lch(lab.xyz), lab.a); }
#endif
Use:
<float3|float4> lab2rgb(<float3|float4> color)
#ifndef FNC_LAB2LCH
#define FNC_LAB2LCH
float3 lab2lch(float3 lab) {
return float3(
lab.x,
sqrt(dot(lab.yz, lab.yz)),
atan(lab.z, lab.y) * 57.2957795131
);
}
float4 lab2lch(float4 lab) { return float4(lab2lch(lab.xyz), lab.a); }
#endif
Use:
<float3|float4> lab2rgb(<float3|float4> color)
#ifndef FNC_LAB2LCH
#define FNC_LAB2LCH
float3 lab2lch(float3 lab) {
return float3(
lab.x,
sqrt(dot(lab.yz, lab.yz)),
atan(lab.zy) * 57.2957795131
);
}
float4 lab2lch(float4 lab) { return float4(lab2lch(lab.xyz), lab.a); }
#endif
fn lab2lch(lab: vec3f) -> vec3f {
return vec3f(
lab.x,
sqrt(dot(lab.yz, lab.yz)),
atan(lab.z, lab.y) * 57.2957795131
);
}
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