once_cell -> std

This commit is contained in:
seth 2024-03-30 03:04:32 -04:00
parent a41a84fd2d
commit 90387c5a3b
No known key found for this signature in database
GPG key ID: D31BD0D494BBEE86
28 changed files with 157 additions and 153 deletions

View file

@ -1,15 +1,17 @@
use std::collections::HashMap;
use std::{collections::HashMap, sync::OnceLock};
use once_cell::sync::Lazy;
use poise::serenity_prelude::Color;
pub static COLORS: Lazy<HashMap<&str, Color>> = Lazy::new(|| {
HashMap::from([
("red", Color::from((239, 68, 68))),
("green", Color::from((34, 197, 94))),
("blue", Color::from((96, 165, 250))),
("yellow", Color::from((253, 224, 71))),
("orange", Color::from((251, 146, 60))),
// TODO purple & pink :D
])
});
pub fn colors() -> &'static HashMap<&'static str, Color> {
static COLORS: OnceLock<HashMap<&str, Color>> = OnceLock::new();
COLORS.get_or_init(|| {
HashMap::from([
("red", Color::from((239, 68, 68))),
("green", Color::from((34, 197, 94))),
("blue", Color::from((96, 165, 250))),
("yellow", Color::from((253, 224, 71))),
("orange", Color::from((251, 146, 60))),
// TODO purple & pink :D
])
})
}