use std::sync::LazyLock;

use hashbrown::HashMap;

use crate::colors::RgbColor888;

pub const TAILWIND_HUES: [&str; 26] = [
	"red", "orange", "amber", "yellow", "lime", "green", "emerald", "teal", "cyan", "sky", "blue",
	"indigo", "violet", "purple", "fuchsia", "pink", "rose", "slate", "gray", "zinc", "neutral",
	"stone", "taupe", "mauve", "mist", "olive",
];

pub const TAILWIND_HUES_CHROMATIC: [&str; 17] = [
	"red", "orange", "amber", "yellow", "lime", "green", "emerald", "teal", "cyan", "sky", "blue",
	"indigo", "violet", "purple", "fuchsia", "pink", "rose",
];

pub const TAILWIND_HUES_NEUTRAL: [&str; 9] = [
	"slate", "gray", "zinc", "neutral", "stone", "taupe", "mauve", "mist", "olive",
];

pub const TAILWIND_SHADES: [u16; 11] = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];

pub static TAILWIND_COLORS: LazyLock<TailwindColors> = LazyLock::new(|| {
	let mut all = HashMap::new();
	let mut hues = HashMap::new();
	let mut chromatic_hues = HashMap::new();
	let mut neutral_hues = HashMap::new();

	let mut lines = TAILWIND_COLORS_HEX.lines();
	for class in TAILWIND_HUES {
		let mut shades = HashMap::new();
		for shade in TAILWIND_SHADES {
			let line = lines.next().expect("Out of data");
			let rgb = RgbColor888::from_rgb24(
				u32::from_str_radix(line, 16).expect("Failed to parse as u32."),
			);

			all.insert(format!("{class}{shade}"), rgb);
			shades.insert(shade, rgb);
		}
		let hue = TailwindHue {
			shade50: *shades.get(&50).unwrap(),
			shade100: *shades.get(&100).unwrap(),
			shade200: *shades.get(&200).unwrap(),
			shade300: *shades.get(&300).unwrap(),
			shade400: *shades.get(&400).unwrap(),
			shade500: *shades.get(&500).unwrap(),
			shade600: *shades.get(&600).unwrap(),
			shade700: *shades.get(&700).unwrap(),
			shade800: *shades.get(&800).unwrap(),
			shade900: *shades.get(&900).unwrap(),
			shade950: *shades.get(&950).unwrap(),
			all: shades,
		};
		if TAILWIND_HUES_CHROMATIC.contains(&class) {
			chromatic_hues.insert(class.to_owned(), hue.clone());
		}
		if TAILWIND_HUES_NEUTRAL.contains(&class) {
			neutral_hues.insert(class.to_owned(), hue.clone());
		}
		hues.insert(class.to_owned(), hue);
	}
	debug_assert_eq!(
		lines.next().expect("Out of data expecting 000000"),
		"000000"
	);
	debug_assert_eq!(
		lines.next().expect("Out of data expecting ffffff"),
		"ffffff"
	);
	debug_assert!(lines.next().is_none());

	TailwindColors {
		chromatic_hues,
		neutral_hues,
		red: hues.get("red").unwrap().clone(),
		orange: hues.get("orange").unwrap().clone(),
		amber: hues.get("amber").unwrap().clone(),
		yellow: hues.get("yellow").unwrap().clone(),
		lime: hues.get("lime").unwrap().clone(),
		green: hues.get("green").unwrap().clone(),
		emerald: hues.get("emerald").unwrap().clone(),
		teal: hues.get("teal").unwrap().clone(),
		cyan: hues.get("cyan").unwrap().clone(),
		sky: hues.get("sky").unwrap().clone(),
		blue: hues.get("blue").unwrap().clone(),
		indigo: hues.get("indigo").unwrap().clone(),
		violet: hues.get("violet").unwrap().clone(),
		purple: hues.get("purple").unwrap().clone(),
		fuchsia: hues.get("fuchsia").unwrap().clone(),
		pink: hues.get("pink").unwrap().clone(),
		rose: hues.get("rose").unwrap().clone(),
		slate: hues.get("slate").unwrap().clone(),
		gray: hues.get("gray").unwrap().clone(),
		zinc: hues.get("zinc").unwrap().clone(),
		neutral: hues.get("neutral").unwrap().clone(),
		stone: hues.get("stone").unwrap().clone(),
		taupe: hues.get("taupe").unwrap().clone(),
		mauve: hues.get("mauve").unwrap().clone(),
		mist: hues.get("mist").unwrap().clone(),
		olive: hues.get("olive").unwrap().clone(),
		hues,
		red50: *all.get("red50").unwrap(),
		red100: *all.get("red100").unwrap(),
		red200: *all.get("red200").unwrap(),
		red300: *all.get("red300").unwrap(),
		red400: *all.get("red400").unwrap(),
		red500: *all.get("red500").unwrap(),
		red600: *all.get("red600").unwrap(),
		red700: *all.get("red700").unwrap(),
		red800: *all.get("red800").unwrap(),
		red900: *all.get("red900").unwrap(),
		red950: *all.get("red950").unwrap(),
		orange50: *all.get("orange50").unwrap(),
		orange100: *all.get("orange100").unwrap(),
		orange200: *all.get("orange200").unwrap(),
		orange300: *all.get("orange300").unwrap(),
		orange400: *all.get("orange400").unwrap(),
		orange500: *all.get("orange500").unwrap(),
		orange600: *all.get("orange600").unwrap(),
		orange700: *all.get("orange700").unwrap(),
		orange800: *all.get("orange800").unwrap(),
		orange900: *all.get("orange900").unwrap(),
		orange950: *all.get("orange950").unwrap(),
		amber50: *all.get("amber50").unwrap(),
		amber100: *all.get("amber100").unwrap(),
		amber200: *all.get("amber200").unwrap(),
		amber300: *all.get("amber300").unwrap(),
		amber400: *all.get("amber400").unwrap(),
		amber500: *all.get("amber500").unwrap(),
		amber600: *all.get("amber600").unwrap(),
		amber700: *all.get("amber700").unwrap(),
		amber800: *all.get("amber800").unwrap(),
		amber900: *all.get("amber900").unwrap(),
		amber950: *all.get("amber950").unwrap(),
		yellow50: *all.get("yellow50").unwrap(),
		yellow100: *all.get("yellow100").unwrap(),
		yellow200: *all.get("yellow200").unwrap(),
		yellow300: *all.get("yellow300").unwrap(),
		yellow400: *all.get("yellow400").unwrap(),
		yellow500: *all.get("yellow500").unwrap(),
		yellow600: *all.get("yellow600").unwrap(),
		yellow700: *all.get("yellow700").unwrap(),
		yellow800: *all.get("yellow800").unwrap(),
		yellow900: *all.get("yellow900").unwrap(),
		yellow950: *all.get("yellow950").unwrap(),
		lime50: *all.get("lime50").unwrap(),
		lime100: *all.get("lime100").unwrap(),
		lime200: *all.get("lime200").unwrap(),
		lime300: *all.get("lime300").unwrap(),
		lime400: *all.get("lime400").unwrap(),
		lime500: *all.get("lime500").unwrap(),
		lime600: *all.get("lime600").unwrap(),
		lime700: *all.get("lime700").unwrap(),
		lime800: *all.get("lime800").unwrap(),
		lime900: *all.get("lime900").unwrap(),
		lime950: *all.get("lime950").unwrap(),
		green50: *all.get("green50").unwrap(),
		green100: *all.get("green100").unwrap(),
		green200: *all.get("green200").unwrap(),
		green300: *all.get("green300").unwrap(),
		green400: *all.get("green400").unwrap(),
		green500: *all.get("green500").unwrap(),
		green600: *all.get("green600").unwrap(),
		green700: *all.get("green700").unwrap(),
		green800: *all.get("green800").unwrap(),
		green900: *all.get("green900").unwrap(),
		green950: *all.get("green950").unwrap(),
		emerald50: *all.get("emerald50").unwrap(),
		emerald100: *all.get("emerald100").unwrap(),
		emerald200: *all.get("emerald200").unwrap(),
		emerald300: *all.get("emerald300").unwrap(),
		emerald400: *all.get("emerald400").unwrap(),
		emerald500: *all.get("emerald500").unwrap(),
		emerald600: *all.get("emerald600").unwrap(),
		emerald700: *all.get("emerald700").unwrap(),
		emerald800: *all.get("emerald800").unwrap(),
		emerald900: *all.get("emerald900").unwrap(),
		emerald950: *all.get("emerald950").unwrap(),
		teal50: *all.get("teal50").unwrap(),
		teal100: *all.get("teal100").unwrap(),
		teal200: *all.get("teal200").unwrap(),
		teal300: *all.get("teal300").unwrap(),
		teal400: *all.get("teal400").unwrap(),
		teal500: *all.get("teal500").unwrap(),
		teal600: *all.get("teal600").unwrap(),
		teal700: *all.get("teal700").unwrap(),
		teal800: *all.get("teal800").unwrap(),
		teal900: *all.get("teal900").unwrap(),
		teal950: *all.get("teal950").unwrap(),
		cyan50: *all.get("cyan50").unwrap(),
		cyan100: *all.get("cyan100").unwrap(),
		cyan200: *all.get("cyan200").unwrap(),
		cyan300: *all.get("cyan300").unwrap(),
		cyan400: *all.get("cyan400").unwrap(),
		cyan500: *all.get("cyan500").unwrap(),
		cyan600: *all.get("cyan600").unwrap(),
		cyan700: *all.get("cyan700").unwrap(),
		cyan800: *all.get("cyan800").unwrap(),
		cyan900: *all.get("cyan900").unwrap(),
		cyan950: *all.get("cyan950").unwrap(),
		sky50: *all.get("sky50").unwrap(),
		sky100: *all.get("sky100").unwrap(),
		sky200: *all.get("sky200").unwrap(),
		sky300: *all.get("sky300").unwrap(),
		sky400: *all.get("sky400").unwrap(),
		sky500: *all.get("sky500").unwrap(),
		sky600: *all.get("sky600").unwrap(),
		sky700: *all.get("sky700").unwrap(),
		sky800: *all.get("sky800").unwrap(),
		sky900: *all.get("sky900").unwrap(),
		sky950: *all.get("sky950").unwrap(),
		blue50: *all.get("blue50").unwrap(),
		blue100: *all.get("blue100").unwrap(),
		blue200: *all.get("blue200").unwrap(),
		blue300: *all.get("blue300").unwrap(),
		blue400: *all.get("blue400").unwrap(),
		blue500: *all.get("blue500").unwrap(),
		blue600: *all.get("blue600").unwrap(),
		blue700: *all.get("blue700").unwrap(),
		blue800: *all.get("blue800").unwrap(),
		blue900: *all.get("blue900").unwrap(),
		blue950: *all.get("blue950").unwrap(),
		indigo50: *all.get("indigo50").unwrap(),
		indigo100: *all.get("indigo100").unwrap(),
		indigo200: *all.get("indigo200").unwrap(),
		indigo300: *all.get("indigo300").unwrap(),
		indigo400: *all.get("indigo400").unwrap(),
		indigo500: *all.get("indigo500").unwrap(),
		indigo600: *all.get("indigo600").unwrap(),
		indigo700: *all.get("indigo700").unwrap(),
		indigo800: *all.get("indigo800").unwrap(),
		indigo900: *all.get("indigo900").unwrap(),
		indigo950: *all.get("indigo950").unwrap(),
		violet50: *all.get("violet50").unwrap(),
		violet100: *all.get("violet100").unwrap(),
		violet200: *all.get("violet200").unwrap(),
		violet300: *all.get("violet300").unwrap(),
		violet400: *all.get("violet400").unwrap(),
		violet500: *all.get("violet500").unwrap(),
		violet600: *all.get("violet600").unwrap(),
		violet700: *all.get("violet700").unwrap(),
		violet800: *all.get("violet800").unwrap(),
		violet900: *all.get("violet900").unwrap(),
		violet950: *all.get("violet950").unwrap(),
		purple50: *all.get("purple50").unwrap(),
		purple100: *all.get("purple100").unwrap(),
		purple200: *all.get("purple200").unwrap(),
		purple300: *all.get("purple300").unwrap(),
		purple400: *all.get("purple400").unwrap(),
		purple500: *all.get("purple500").unwrap(),
		purple600: *all.get("purple600").unwrap(),
		purple700: *all.get("purple700").unwrap(),
		purple800: *all.get("purple800").unwrap(),
		purple900: *all.get("purple900").unwrap(),
		purple950: *all.get("purple950").unwrap(),
		fuchsia50: *all.get("fuchsia50").unwrap(),
		fuchsia100: *all.get("fuchsia100").unwrap(),
		fuchsia200: *all.get("fuchsia200").unwrap(),
		fuchsia300: *all.get("fuchsia300").unwrap(),
		fuchsia400: *all.get("fuchsia400").unwrap(),
		fuchsia500: *all.get("fuchsia500").unwrap(),
		fuchsia600: *all.get("fuchsia600").unwrap(),
		fuchsia700: *all.get("fuchsia700").unwrap(),
		fuchsia800: *all.get("fuchsia800").unwrap(),
		fuchsia900: *all.get("fuchsia900").unwrap(),
		fuchsia950: *all.get("fuchsia950").unwrap(),
		pink50: *all.get("pink50").unwrap(),
		pink100: *all.get("pink100").unwrap(),
		pink200: *all.get("pink200").unwrap(),
		pink300: *all.get("pink300").unwrap(),
		pink400: *all.get("pink400").unwrap(),
		pink500: *all.get("pink500").unwrap(),
		pink600: *all.get("pink600").unwrap(),
		pink700: *all.get("pink700").unwrap(),
		pink800: *all.get("pink800").unwrap(),
		pink900: *all.get("pink900").unwrap(),
		pink950: *all.get("pink950").unwrap(),
		rose50: *all.get("rose50").unwrap(),
		rose100: *all.get("rose100").unwrap(),
		rose200: *all.get("rose200").unwrap(),
		rose300: *all.get("rose300").unwrap(),
		rose400: *all.get("rose400").unwrap(),
		rose500: *all.get("rose500").unwrap(),
		rose600: *all.get("rose600").unwrap(),
		rose700: *all.get("rose700").unwrap(),
		rose800: *all.get("rose800").unwrap(),
		rose900: *all.get("rose900").unwrap(),
		rose950: *all.get("rose950").unwrap(),
		slate50: *all.get("slate50").unwrap(),
		slate100: *all.get("slate100").unwrap(),
		slate200: *all.get("slate200").unwrap(),
		slate300: *all.get("slate300").unwrap(),
		slate400: *all.get("slate400").unwrap(),
		slate500: *all.get("slate500").unwrap(),
		slate600: *all.get("slate600").unwrap(),
		slate700: *all.get("slate700").unwrap(),
		slate800: *all.get("slate800").unwrap(),
		slate900: *all.get("slate900").unwrap(),
		slate950: *all.get("slate950").unwrap(),
		gray50: *all.get("gray50").unwrap(),
		gray100: *all.get("gray100").unwrap(),
		gray200: *all.get("gray200").unwrap(),
		gray300: *all.get("gray300").unwrap(),
		gray400: *all.get("gray400").unwrap(),
		gray500: *all.get("gray500").unwrap(),
		gray600: *all.get("gray600").unwrap(),
		gray700: *all.get("gray700").unwrap(),
		gray800: *all.get("gray800").unwrap(),
		gray900: *all.get("gray900").unwrap(),
		gray950: *all.get("gray950").unwrap(),
		zinc50: *all.get("zinc50").unwrap(),
		zinc100: *all.get("zinc100").unwrap(),
		zinc200: *all.get("zinc200").unwrap(),
		zinc300: *all.get("zinc300").unwrap(),
		zinc400: *all.get("zinc400").unwrap(),
		zinc500: *all.get("zinc500").unwrap(),
		zinc600: *all.get("zinc600").unwrap(),
		zinc700: *all.get("zinc700").unwrap(),
		zinc800: *all.get("zinc800").unwrap(),
		zinc900: *all.get("zinc900").unwrap(),
		zinc950: *all.get("zinc950").unwrap(),
		neutral50: *all.get("neutral50").unwrap(),
		neutral100: *all.get("neutral100").unwrap(),
		neutral200: *all.get("neutral200").unwrap(),
		neutral300: *all.get("neutral300").unwrap(),
		neutral400: *all.get("neutral400").unwrap(),
		neutral500: *all.get("neutral500").unwrap(),
		neutral600: *all.get("neutral600").unwrap(),
		neutral700: *all.get("neutral700").unwrap(),
		neutral800: *all.get("neutral800").unwrap(),
		neutral900: *all.get("neutral900").unwrap(),
		neutral950: *all.get("neutral950").unwrap(),
		stone50: *all.get("stone50").unwrap(),
		stone100: *all.get("stone100").unwrap(),
		stone200: *all.get("stone200").unwrap(),
		stone300: *all.get("stone300").unwrap(),
		stone400: *all.get("stone400").unwrap(),
		stone500: *all.get("stone500").unwrap(),
		stone600: *all.get("stone600").unwrap(),
		stone700: *all.get("stone700").unwrap(),
		stone800: *all.get("stone800").unwrap(),
		stone900: *all.get("stone900").unwrap(),
		stone950: *all.get("stone950").unwrap(),
		taupe50: *all.get("taupe50").unwrap(),
		taupe100: *all.get("taupe100").unwrap(),
		taupe200: *all.get("taupe200").unwrap(),
		taupe300: *all.get("taupe300").unwrap(),
		taupe400: *all.get("taupe400").unwrap(),
		taupe500: *all.get("taupe500").unwrap(),
		taupe600: *all.get("taupe600").unwrap(),
		taupe700: *all.get("taupe700").unwrap(),
		taupe800: *all.get("taupe800").unwrap(),
		taupe900: *all.get("taupe900").unwrap(),
		taupe950: *all.get("taupe950").unwrap(),
		mauve50: *all.get("mauve50").unwrap(),
		mauve100: *all.get("mauve100").unwrap(),
		mauve200: *all.get("mauve200").unwrap(),
		mauve300: *all.get("mauve300").unwrap(),
		mauve400: *all.get("mauve400").unwrap(),
		mauve500: *all.get("mauve500").unwrap(),
		mauve600: *all.get("mauve600").unwrap(),
		mauve700: *all.get("mauve700").unwrap(),
		mauve800: *all.get("mauve800").unwrap(),
		mauve900: *all.get("mauve900").unwrap(),
		mauve950: *all.get("mauve950").unwrap(),
		mist50: *all.get("mist50").unwrap(),
		mist100: *all.get("mist100").unwrap(),
		mist200: *all.get("mist200").unwrap(),
		mist300: *all.get("mist300").unwrap(),
		mist400: *all.get("mist400").unwrap(),
		mist500: *all.get("mist500").unwrap(),
		mist600: *all.get("mist600").unwrap(),
		mist700: *all.get("mist700").unwrap(),
		mist800: *all.get("mist800").unwrap(),
		mist900: *all.get("mist900").unwrap(),
		mist950: *all.get("mist950").unwrap(),
		olive50: *all.get("olive50").unwrap(),
		olive100: *all.get("olive100").unwrap(),
		olive200: *all.get("olive200").unwrap(),
		olive300: *all.get("olive300").unwrap(),
		olive400: *all.get("olive400").unwrap(),
		olive500: *all.get("olive500").unwrap(),
		olive600: *all.get("olive600").unwrap(),
		olive700: *all.get("olive700").unwrap(),
		olive800: *all.get("olive800").unwrap(),
		olive900: *all.get("olive900").unwrap(),
		olive950: *all.get("olive950").unwrap(),
		all,
	}
});

const TAILWIND_COLORS_HEX: &str = include_str!("tailwind-4.2.hex");

#[derive(Clone, Debug)]
pub struct TailwindHue {
	pub all: HashMap<u16, RgbColor888>,
	pub shade50: RgbColor888,
	pub shade100: RgbColor888,
	pub shade200: RgbColor888,
	pub shade300: RgbColor888,
	pub shade400: RgbColor888,
	pub shade500: RgbColor888,
	pub shade600: RgbColor888,
	pub shade700: RgbColor888,
	pub shade800: RgbColor888,
	pub shade900: RgbColor888,
	pub shade950: RgbColor888,
}

#[allow(dead_code)]
#[derive(Debug)]
pub struct TailwindColors {
	pub all: HashMap<String, RgbColor888>,
	pub hues: HashMap<String, TailwindHue>,
	pub chromatic_hues: HashMap<String, TailwindHue>,
	pub neutral_hues: HashMap<String, TailwindHue>,
	pub red: TailwindHue,
	pub orange: TailwindHue,
	pub amber: TailwindHue,
	pub yellow: TailwindHue,
	pub lime: TailwindHue,
	pub green: TailwindHue,
	pub emerald: TailwindHue,
	pub teal: TailwindHue,
	pub cyan: TailwindHue,
	pub sky: TailwindHue,
	pub blue: TailwindHue,
	pub indigo: TailwindHue,
	pub violet: TailwindHue,
	pub purple: TailwindHue,
	pub fuchsia: TailwindHue,
	pub pink: TailwindHue,
	pub rose: TailwindHue,
	pub slate: TailwindHue,
	pub gray: TailwindHue,
	pub zinc: TailwindHue,
	pub neutral: TailwindHue,
	pub stone: TailwindHue,
	pub taupe: TailwindHue,
	pub mauve: TailwindHue,
	pub mist: TailwindHue,
	pub olive: TailwindHue,
	pub red50: RgbColor888,
	pub red100: RgbColor888,
	pub red200: RgbColor888,
	pub red300: RgbColor888,
	pub red400: RgbColor888,
	pub red500: RgbColor888,
	pub red600: RgbColor888,
	pub red700: RgbColor888,
	pub red800: RgbColor888,
	pub red900: RgbColor888,
	pub red950: RgbColor888,
	pub orange50: RgbColor888,
	pub orange100: RgbColor888,
	pub orange200: RgbColor888,
	pub orange300: RgbColor888,
	pub orange400: RgbColor888,
	pub orange500: RgbColor888,
	pub orange600: RgbColor888,
	pub orange700: RgbColor888,
	pub orange800: RgbColor888,
	pub orange900: RgbColor888,
	pub orange950: RgbColor888,
	pub amber50: RgbColor888,
	pub amber100: RgbColor888,
	pub amber200: RgbColor888,
	pub amber300: RgbColor888,
	pub amber400: RgbColor888,
	pub amber500: RgbColor888,
	pub amber600: RgbColor888,
	pub amber700: RgbColor888,
	pub amber800: RgbColor888,
	pub amber900: RgbColor888,
	pub amber950: RgbColor888,
	pub yellow50: RgbColor888,
	pub yellow100: RgbColor888,
	pub yellow200: RgbColor888,
	pub yellow300: RgbColor888,
	pub yellow400: RgbColor888,
	pub yellow500: RgbColor888,
	pub yellow600: RgbColor888,
	pub yellow700: RgbColor888,
	pub yellow800: RgbColor888,
	pub yellow900: RgbColor888,
	pub yellow950: RgbColor888,
	pub lime50: RgbColor888,
	pub lime100: RgbColor888,
	pub lime200: RgbColor888,
	pub lime300: RgbColor888,
	pub lime400: RgbColor888,
	pub lime500: RgbColor888,
	pub lime600: RgbColor888,
	pub lime700: RgbColor888,
	pub lime800: RgbColor888,
	pub lime900: RgbColor888,
	pub lime950: RgbColor888,
	pub green50: RgbColor888,
	pub green100: RgbColor888,
	pub green200: RgbColor888,
	pub green300: RgbColor888,
	pub green400: RgbColor888,
	pub green500: RgbColor888,
	pub green600: RgbColor888,
	pub green700: RgbColor888,
	pub green800: RgbColor888,
	pub green900: RgbColor888,
	pub green950: RgbColor888,
	pub emerald50: RgbColor888,
	pub emerald100: RgbColor888,
	pub emerald200: RgbColor888,
	pub emerald300: RgbColor888,
	pub emerald400: RgbColor888,
	pub emerald500: RgbColor888,
	pub emerald600: RgbColor888,
	pub emerald700: RgbColor888,
	pub emerald800: RgbColor888,
	pub emerald900: RgbColor888,
	pub emerald950: RgbColor888,
	pub teal50: RgbColor888,
	pub teal100: RgbColor888,
	pub teal200: RgbColor888,
	pub teal300: RgbColor888,
	pub teal400: RgbColor888,
	pub teal500: RgbColor888,
	pub teal600: RgbColor888,
	pub teal700: RgbColor888,
	pub teal800: RgbColor888,
	pub teal900: RgbColor888,
	pub teal950: RgbColor888,
	pub cyan50: RgbColor888,
	pub cyan100: RgbColor888,
	pub cyan200: RgbColor888,
	pub cyan300: RgbColor888,
	pub cyan400: RgbColor888,
	pub cyan500: RgbColor888,
	pub cyan600: RgbColor888,
	pub cyan700: RgbColor888,
	pub cyan800: RgbColor888,
	pub cyan900: RgbColor888,
	pub cyan950: RgbColor888,
	pub sky50: RgbColor888,
	pub sky100: RgbColor888,
	pub sky200: RgbColor888,
	pub sky300: RgbColor888,
	pub sky400: RgbColor888,
	pub sky500: RgbColor888,
	pub sky600: RgbColor888,
	pub sky700: RgbColor888,
	pub sky800: RgbColor888,
	pub sky900: RgbColor888,
	pub sky950: RgbColor888,
	pub blue50: RgbColor888,
	pub blue100: RgbColor888,
	pub blue200: RgbColor888,
	pub blue300: RgbColor888,
	pub blue400: RgbColor888,
	pub blue500: RgbColor888,
	pub blue600: RgbColor888,
	pub blue700: RgbColor888,
	pub blue800: RgbColor888,
	pub blue900: RgbColor888,
	pub blue950: RgbColor888,
	pub indigo50: RgbColor888,
	pub indigo100: RgbColor888,
	pub indigo200: RgbColor888,
	pub indigo300: RgbColor888,
	pub indigo400: RgbColor888,
	pub indigo500: RgbColor888,
	pub indigo600: RgbColor888,
	pub indigo700: RgbColor888,
	pub indigo800: RgbColor888,
	pub indigo900: RgbColor888,
	pub indigo950: RgbColor888,
	pub violet50: RgbColor888,
	pub violet100: RgbColor888,
	pub violet200: RgbColor888,
	pub violet300: RgbColor888,
	pub violet400: RgbColor888,
	pub violet500: RgbColor888,
	pub violet600: RgbColor888,
	pub violet700: RgbColor888,
	pub violet800: RgbColor888,
	pub violet900: RgbColor888,
	pub violet950: RgbColor888,
	pub purple50: RgbColor888,
	pub purple100: RgbColor888,
	pub purple200: RgbColor888,
	pub purple300: RgbColor888,
	pub purple400: RgbColor888,
	pub purple500: RgbColor888,
	pub purple600: RgbColor888,
	pub purple700: RgbColor888,
	pub purple800: RgbColor888,
	pub purple900: RgbColor888,
	pub purple950: RgbColor888,
	pub fuchsia50: RgbColor888,
	pub fuchsia100: RgbColor888,
	pub fuchsia200: RgbColor888,
	pub fuchsia300: RgbColor888,
	pub fuchsia400: RgbColor888,
	pub fuchsia500: RgbColor888,
	pub fuchsia600: RgbColor888,
	pub fuchsia700: RgbColor888,
	pub fuchsia800: RgbColor888,
	pub fuchsia900: RgbColor888,
	pub fuchsia950: RgbColor888,
	pub pink50: RgbColor888,
	pub pink100: RgbColor888,
	pub pink200: RgbColor888,
	pub pink300: RgbColor888,
	pub pink400: RgbColor888,
	pub pink500: RgbColor888,
	pub pink600: RgbColor888,
	pub pink700: RgbColor888,
	pub pink800: RgbColor888,
	pub pink900: RgbColor888,
	pub pink950: RgbColor888,
	pub rose50: RgbColor888,
	pub rose100: RgbColor888,
	pub rose200: RgbColor888,
	pub rose300: RgbColor888,
	pub rose400: RgbColor888,
	pub rose500: RgbColor888,
	pub rose600: RgbColor888,
	pub rose700: RgbColor888,
	pub rose800: RgbColor888,
	pub rose900: RgbColor888,
	pub rose950: RgbColor888,
	pub slate50: RgbColor888,
	pub slate100: RgbColor888,
	pub slate200: RgbColor888,
	pub slate300: RgbColor888,
	pub slate400: RgbColor888,
	pub slate500: RgbColor888,
	pub slate600: RgbColor888,
	pub slate700: RgbColor888,
	pub slate800: RgbColor888,
	pub slate900: RgbColor888,
	pub slate950: RgbColor888,
	pub gray50: RgbColor888,
	pub gray100: RgbColor888,
	pub gray200: RgbColor888,
	pub gray300: RgbColor888,
	pub gray400: RgbColor888,
	pub gray500: RgbColor888,
	pub gray600: RgbColor888,
	pub gray700: RgbColor888,
	pub gray800: RgbColor888,
	pub gray900: RgbColor888,
	pub gray950: RgbColor888,
	pub zinc50: RgbColor888,
	pub zinc100: RgbColor888,
	pub zinc200: RgbColor888,
	pub zinc300: RgbColor888,
	pub zinc400: RgbColor888,
	pub zinc500: RgbColor888,
	pub zinc600: RgbColor888,
	pub zinc700: RgbColor888,
	pub zinc800: RgbColor888,
	pub zinc900: RgbColor888,
	pub zinc950: RgbColor888,
	pub neutral50: RgbColor888,
	pub neutral100: RgbColor888,
	pub neutral200: RgbColor888,
	pub neutral300: RgbColor888,
	pub neutral400: RgbColor888,
	pub neutral500: RgbColor888,
	pub neutral600: RgbColor888,
	pub neutral700: RgbColor888,
	pub neutral800: RgbColor888,
	pub neutral900: RgbColor888,
	pub neutral950: RgbColor888,
	pub stone50: RgbColor888,
	pub stone100: RgbColor888,
	pub stone200: RgbColor888,
	pub stone300: RgbColor888,
	pub stone400: RgbColor888,
	pub stone500: RgbColor888,
	pub stone600: RgbColor888,
	pub stone700: RgbColor888,
	pub stone800: RgbColor888,
	pub stone900: RgbColor888,
	pub stone950: RgbColor888,
	pub taupe50: RgbColor888,
	pub taupe100: RgbColor888,
	pub taupe200: RgbColor888,
	pub taupe300: RgbColor888,
	pub taupe400: RgbColor888,
	pub taupe500: RgbColor888,
	pub taupe600: RgbColor888,
	pub taupe700: RgbColor888,
	pub taupe800: RgbColor888,
	pub taupe900: RgbColor888,
	pub taupe950: RgbColor888,
	pub mauve50: RgbColor888,
	pub mauve100: RgbColor888,
	pub mauve200: RgbColor888,
	pub mauve300: RgbColor888,
	pub mauve400: RgbColor888,
	pub mauve500: RgbColor888,
	pub mauve600: RgbColor888,
	pub mauve700: RgbColor888,
	pub mauve800: RgbColor888,
	pub mauve900: RgbColor888,
	pub mauve950: RgbColor888,
	pub mist50: RgbColor888,
	pub mist100: RgbColor888,
	pub mist200: RgbColor888,
	pub mist300: RgbColor888,
	pub mist400: RgbColor888,
	pub mist500: RgbColor888,
	pub mist600: RgbColor888,
	pub mist700: RgbColor888,
	pub mist800: RgbColor888,
	pub mist900: RgbColor888,
	pub mist950: RgbColor888,
	pub olive50: RgbColor888,
	pub olive100: RgbColor888,
	pub olive200: RgbColor888,
	pub olive300: RgbColor888,
	pub olive400: RgbColor888,
	pub olive500: RgbColor888,
	pub olive600: RgbColor888,
	pub olive700: RgbColor888,
	pub olive800: RgbColor888,
	pub olive900: RgbColor888,
	pub olive950: RgbColor888,
}

impl TailwindColors {
	#[must_use]
	pub fn get(&self, s: &str) -> Option<RgbColor888> {
		let s = s.chars().filter(char::is_ascii).collect::<String>();
		let first_digit = s
			.bytes()
			.position(|c| c.is_ascii_digit())
			.unwrap_or(s.len());
		let (before_first_digit, from_first_digit) = s.split_at(first_digit);

		let hue = String::from_utf8_lossy(
			before_first_digit
				.bytes()
				.filter(u8::is_ascii_alphabetic)
				.collect::<Vec<u8>>()
				.as_slice(),
		)
		.to_ascii_lowercase();

		let shade = if let Ok(x) = String::from_utf8_lossy(
			from_first_digit
				.bytes()
				.filter(u8::is_ascii_digit)
				.collect::<Vec<u8>>()
				.as_slice(),
		)
		.parse::<u16>()
			&& ((100..=900).contains(&x) && x % 100 == 0 || x == 50 || x == 950)
		{
			x
		} else {
			500
		};

		self.all.get(format!("{hue}{shade}").as_str()).copied()
	}
}

#[cfg(test)]
mod tests {
	#[allow(unused_imports)]
	use super::*;

	#[test]
	fn test_colors() {
		assert_eq!(
			TAILWIND_COLORS.red500,
			RgbColor888 {
				r8: 0xfb,
				g8: 0x2c,
				b8: 0x36
			},
			"{TAILWIND_COLORS:?}"
		);
	}
}
