hex_color 3.0.0

A simple, lightweight library for working with RGB(A) hexadecimal colors.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use rand::distributions::{Distribution, Standard};
use rand::Rng;

use crate::HexColor;

#[cfg_attr(doc_cfg, doc(cfg(feature = "rand")))]
impl Distribution<HexColor> for Standard {
    #[inline]
    fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> HexColor {
        HexColor::rgb(rng.gen(), rng.gen(), rng.gen())
    }
}