Skip to main content

PerceptualRound

Trait PerceptualRound 

Source
pub trait PerceptualRound: Sized {
    // Required method
    fn round(self) -> Self;
}
Expand description

Rounds a colour’s channels to perceptually safe precision.

The number of decimal places per channel is determined by the channel’s value range, so that each rounding step represents roughly the same fraction of the perceptual range. Small-range channels (e.g. OKLab 0–1) keep more decimal places, while large-range channels (e.g. hue 0–360, Lab L 0–100) need fewer.

The precisions used are chosen to be well below the Just Noticeable Difference (JND) while still surviving chained colour operations like color-mix() and relative colour syntax without accumulating visible error.

See: https://keithcirkel.co.uk/too-much-color/

Required Methods§

Source

fn round(self) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§