MCPcopy Create free account
hub / github.com/csskit/csskit / round

Method round

crates/chromashift/src/round.rs:66–86  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

64
65impl PerceptualRound for Color {
66 fn round(self) -> Self {
67 match self {
68 Color::A98Rgb(c) => Color::A98Rgb(c.round()),
69 Color::DisplayP3(c) => Color::DisplayP3(c.round()),
70 Color::Hex(c) => Color::Hex(c.round()),
71 Color::Hsv(c) => Color::Hsv(c.round()),
72 Color::Hsl(c) => Color::Hsl(c.round()),
73 Color::Hwb(c) => Color::Hwb(c.round()),
74 Color::Lab(c) => Color::Lab(c.round()),
75 Color::Lch(c) => Color::Lch(c.round()),
76 Color::LinearRgb(c) => Color::LinearRgb(c.round()),
77 Color::Named(n) => Color::Named(n.round()),
78 Color::Oklab(c) => Color::Oklab(c.round()),
79 Color::Oklch(c) => Color::Oklch(c.round()),
80 Color::ProphotoRgb(c) => Color::ProphotoRgb(c.round()),
81 Color::Rec2020(c) => Color::Rec2020(c.round()),
82 Color::Srgb(c) => Color::Srgb(c.round()),
83 Color::XyzD50(c) => Color::XyzD50(c.round()),
84 Color::XyzD65(c) => Color::XyzD65(c.round()),
85 }
86 }
87}
88
89#[cfg(test)]

Callers 15

to_chromashiftMethod · 0.80
to_chromashiftMethod · 0.80
shortestMethod · 0.80
visit_colorMethod · 0.80
round_dpFunction · 0.80
fromMethod · 0.80
oklch_roundFunction · 0.80
oklab_roundFunction · 0.80
lab_roundFunction · 0.80
lch_roundFunction · 0.80

Calls 15

A98RgbClass · 0.85
DisplayP3Class · 0.85
HexClass · 0.85
HsvClass · 0.85
HslClass · 0.85
HwbClass · 0.85
LabClass · 0.85
LchClass · 0.85
LinearRgbClass · 0.85
NamedEnum · 0.85
OklabClass · 0.85
OklchClass · 0.85

Tested by 8

oklch_roundFunction · 0.64
oklab_roundFunction · 0.64
lab_roundFunction · 0.64
lch_roundFunction · 0.64
hsl_roundFunction · 0.64
display_p3_roundFunction · 0.64
color_enum_roundFunction · 0.64