pride-overlay 1.2.1

A crate to overlay pride flags on images.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/// The opacity of a pixel (0-255)
pub struct Opacity(pub u8);

impl Opacity {
    pub fn new(opacity: u8) -> Opacity {
        Opacity(opacity)
    }

    pub fn from_percentage(percentage: f32) -> Option<Opacity> {
        if (0. ..=100.).contains(&percentage) {
            return Some(Opacity((2.55 * percentage).floor() as u8));
        }

        None
    }
}