cosmic::cosmic_theme::palette

Trait IntoColor

source
pub trait IntoColor<T>: Sized {
    // Required method
    fn into_color(self) -> T;
}
Expand description

A trait for converting a color into another, in a possibly lossy way.

U: IntoColor<T> is implemented for every type T: FromColor<U>.

See FromColor for more details.

Required Methods§

source

fn into_color(self) -> T

Convert into T with values clamped to the color defined bounds

use palette::{IsWithinBounds, IntoColor, Lch, Srgb};

let rgb: Srgb = Lch::new(50.0, 100.0, -175.0).into_color();
assert!(rgb.is_within_bounds());

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T, U> IntoColor<U> for T
where U: FromColor<T>,