Color Channels
Extracts the color channels.
red
Extracts the red channel of color as a number between 0 and 255.
Examples
use color_art::color;
let color = color!(#abcdef);
color.red(); // 171green
Extracts the green channel of color as a number between 0 and 255.
Examples
use color_art::color;
let color = color!(#abcdef);
color.green(); // 205blue
Extracts the blue channel of color as a number between 0 and 255.
Examples
use color_art::color;
let color = color!(#abcdef);
color.blue(); // 239alpha
Extracts the alpha channel of color as a number between 0.0 and 1.0.
Examples
use color_art::color;
let color = color!(#abcdef);
color.alpha(); // 1.0hue
Extracts the hue channel of color as a number between 0.0 and 360.0.
Examples
use color_art::color;
let color = color!(#abcdef);
color.hue(); // 210.0saturation
Extracts the HSL saturation of color as a number between 0.0 and 1.0.
Examples
use color_art::color;
let color = color!(#abcdef);
color.saturation(); // 0.68lightness
Extracts the HSL lightness of color as a number between 0.0 and 1.0.
Examples
use color_art::color;
let color = color!(#abcdef);
color.lightness(); // 0.8039whiteness
Extracts the HWB whiteness of color as a number between 0.0 and 1.0.
Examples
use color_art::color;
let color = color!(#abcdef);
color.whiteness(); // 0.6706blackness
Extracts the HWB blackness of color as a number between 0.0 and 1.0.
Examples
use color_art::color;
let color = color!(#abcdef);
color.blackness(); // 0.0627hsv_hue
Extracts the hue channel of color in the HSV color space.
Examples
use color_art::color;
let color = color!(#abcdef);
color.hsv_hue(); // 210.0hsv_saturation
Extracts the saturation channel of color in the HSV color space.
Examples
use color_art::color;
let color = color!(#abcdef);
color.hsv_saturation(); // 0.2845hsv_value
Extracts the value channel of color in the HSV color space.
Examples
use color_art::color;
let color = color!(#abcdef);
color.hsv_value(); // 0.9373luma
Calculates the luma (perceptual brightness) of color.
Examples
use color_art::color;
let color = color!(#abcdef);
color.luma(); // 0.59luminance
Calculates the value of the luma without gamma correction.
Examples
use color_art::color;
let color = color!(#abcdef);
color.luminance(); // 0.79gray
Calculates the gray value of color.
Examples
use color_art::color;
let color = color!(#abcdef);
color.gray(); // 198.71