## rgb2yiq (`lygia`/`color`/`space`/`rgb2yiq`)

Convert from linear RGB to YIQ which was the followin range. Using conversion matrices from FCC NTSC Standard (SMPTE C) https://en.wikipedia.org/wiki/YIQ

Use:

``````rgb2yiq(<vec3|vec4> color)
``````

Check it on Github

``````
#ifndef FNC_RGB2YIQ
#define FNC_RGB2YIQ

const mat3 rgb2yiq_mat = mat3(0.300,  0.5900,  0.1100,
0.599, -0.2773, -0.3217,
0.213, -0.5251,  0.3121);

vec3 rgb2yiq(in vec3 rgb) {
return rgb2yiq_mat * rgb;
}

vec4 rgb2yiq(in vec4 rgb) {
return vec4(rgb2yiq(rgb.rgb), rgb.a);
}
#endif

``````

Use:

``````<float3|float4> rgb2yiq(<float3|float4> color)
``````

Check it on Github

``````
#ifndef FNC_RGB2YIQ
#define FNC_RGB2YIQ
const float3x3 rgb2yiq_mat = float3x3(
0.300,  0.5900,  0.1100,
0.599, -0.2773, -0.3217,
0.213, -0.5251,  0.3121
);

float3 rgb2yiq(in float3 rgb) {
return mul(rgb2yiq_mat, rgb);
}

float4 rgb2yiq(in float4 rgb) {
return float4(rgb2yiq(rgb.rgb), rgb.a);
}
#endif

``````

Check it on Github

``````const rgb2yiq_mat : mat3x3<f32>  = mat3x3<f32>( vec3<f32>(0.300,  0.5900,  0.1100),
vec3<f32>(0.599, -0.2773, -0.3217),
vec3<f32>(0.213, -0.5251,  0.3121) );

fn rgb2yiq(rgb : vec3<f32>) -> vec3<f32> {
return rgb2yiq_mat * rgb;
}

``````