aboutsummaryrefslogtreecommitdiff
path: root/client/src/world/helper.rs
blob: fab452af4eb592601dc37de72cf4db79976c3379 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::fmt::Display;

#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
pub struct Color {
    pub a: u8,
    pub r: u8,
    pub g: u8,
    pub b: u8,
}

impl Display for Color {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_fmt(format_args!(
            "#{:02x}{:02x}{:02x}{:02x}",
            self.r, self.g, self.b, self.a
        ))
    }
}