const-css-color 0.1.1

Css color parser at compile time
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use super::*;

mod convert;
mod display;

impl RGBA32 {
    /// Normalize [`RGBA32`] color.
    pub fn normalized(&self) -> Self {
        Self {
            r: self.r.min(1.0).max(0.0),
            g: self.g.min(1.0).max(0.0),
            b: self.b.min(1.0).max(0.0),
            a: self.a.min(1.0).max(0.0),
        }
    }
}