1
Fork 0
mirror of https://github.com/Steffo99/patched-porobot.git synced 2024-12-23 01:54:22 +00:00

Add CardRarity::color()

This commit is contained in:
Steffo 2023-10-23 00:34:00 +02:00
parent 97899f3ca2
commit 85aac42dd2
Signed by: steffo
GPG key ID: 2A24051445686895

View file

@ -50,6 +50,20 @@ impl CardRarity {
CardRarity::Unsupported => "",
}
}
/// Get the color associated with this [`CardRarity`].
///
/// Used for example to determine the color of the Discord embed.
pub fn color(&self) -> u32 {
match self {
CardRarity::None => 0x202225,
CardRarity::Common => 0x1e6a49,
CardRarity::Rare => 0x244778,
CardRarity::Epic => 0x502970,
CardRarity::Champion => 0x81541f,
CardRarity::Unsupported => 0xff0000,
}
}
}
#[cfg(test)]