const SALTS: [u8; 142] = [
3, 8, 0, 5, 0, 0, 0, 0, 3, 0, 1, 0, 9, 0, 112, 7, 3, 0, 1, 19, 1, 0, 0, 0, 7, 3, 5, 2, 23, 38,
9, 0, 4, 28, 5, 3, 0, 0, 1, 0, 0, 18, 7, 0, 3, 2, 8, 2, 13, 16, 12, 1, 3, 0, 11, 0, 14, 0, 1,
0, 2, 4, 1, 0, 3, 6, 1, 0, 3, 3, 0, 0, 3, 0, 6, 17, 0, 10, 0, 0, 1, 1, 7, 12, 1, 7, 0, 2, 0, 0,
1, 1, 1, 2, 1, 0, 1, 0, 3, 6, 5, 1, 0, 1, 5, 0, 2, 0, 0, 1, 0, 1, 0, 1, 0, 1, 6, 6, 2, 2, 0, 5,
0, 0, 1, 4, 2, 0, 0, 2, 2, 0, 1, 0, 0, 1, 5, 0, 0, 1, 0, 0,
];
pub(crate) const NAMES: [&str; 142] = [
"rosybrown",
"forestgreen",
"cornsilk",
"silver",
"purple",
"thistle",
"antiquewhite",
"mediumspringgreen",
"dimgray",
"olivedrab",
"wheat",
"mediumturquoise",
"darkseagreen",
"burlywood",
"magenta",
"lemonchiffon",
"darkkhaki",
"lightyellow",
"mediumslateblue",
"mediumorchid",
"rebeccapurple",
"transparent",
"springgreen",
"maroon",
"lightseagreen",
"yellow",
"gray",
"tan",
"gainsboro",
"chartreuse",
"gold",
"orchid",
"red",
"snow",
"greenyellow",
"limegreen",
"aqua",
"salmon",
"sienna",
"slateblue",
"aquamarine",
"azure",
"saddlebrown",
"lightskyblue",
"cornflowerblue",
"darkorange",
"dodgerblue",
"midnightblue",
"mediumpurple",
"white",
"darkslateblue",
"darkturquoise",
"paleturquoise",
"linen",
"slategray",
"lightpink",
"lightcyan",
"peru",
"beige",
"indianred",
"navajowhite",
"green",
"lightblue",
"mediumaquamarine",
"palegreen",
"skyblue",
"darkviolet",
"deeppink",
"darkcyan",
"peachpuff",
"navy",
"darkolivegreen",
"lavender",
"lightgoldenrodyellow",
"moccasin",
"deepskyblue",
"firebrick",
"ghostwhite",
"honeydew",
"turquoise",
"darkorchid",
"plum",
"lightgray",
"chocolate",
"lightsteelblue",
"bisque",
"mediumblue",
"aliceblue",
"lightcoral",
"lightslategray",
"darkgreen",
"mintcream",
"coral",
"darkmagenta",
"mistyrose",
"whitesmoke",
"lightsalmon",
"mediumvioletred",
"tomato",
"indigo",
"brown",
"lawngreen",
"cadetblue",
"violet",
"fuchsia",
"darkblue",
"orange",
"mediumseagreen",
"lime",
"blue",
"darkred",
"blueviolet",
"papayawhip",
"blanchedalmond",
"seagreen",
"steelblue",
"seashell",
"lavenderblush",
"floralwhite",
"lightgreen",
"darksalmon",
"black",
"crimson",
"hotpink",
"darkslategray",
"palevioletred",
"oldlace",
"darkgray",
"olive",
"palegoldenrod",
"powderblue",
"pink",
"orangered",
"ivory",
"teal",
"cyan",
"darkgoldenrod",
"royalblue",
"sandybrown",
"khaki",
"goldenrod",
"yellowgreen",
];
pub(crate) const COLORS: [[u8; 4]; 142] = [
[188, 143, 143, 255],
[34, 139, 34, 255],
[255, 248, 220, 255],
[192, 192, 192, 255],
[128, 0, 128, 255],
[216, 191, 216, 255],
[250, 235, 215, 255],
[0, 250, 154, 255],
[105, 105, 105, 255],
[107, 142, 35, 255],
[245, 222, 179, 255],
[72, 209, 204, 255],
[143, 188, 143, 255],
[222, 184, 135, 255],
[255, 0, 255, 255],
[255, 250, 205, 255],
[189, 183, 107, 255],
[255, 255, 224, 255],
[123, 104, 238, 255],
[186, 85, 211, 255],
[102, 51, 153, 255],
[0, 0, 0, 0],
[0, 255, 127, 255],
[128, 0, 0, 255],
[32, 178, 170, 255],
[255, 255, 0, 255],
[128, 128, 128, 255],
[210, 180, 140, 255],
[220, 220, 220, 255],
[127, 255, 0, 255],
[255, 215, 0, 255],
[218, 112, 214, 255],
[255, 0, 0, 255],
[255, 250, 250, 255],
[173, 255, 47, 255],
[50, 205, 50, 255],
[0, 255, 255, 255],
[250, 128, 114, 255],
[160, 82, 45, 255],
[106, 90, 205, 255],
[127, 255, 212, 255],
[240, 255, 255, 255],
[139, 69, 19, 255],
[135, 206, 250, 255],
[100, 149, 237, 255],
[255, 140, 0, 255],
[30, 144, 255, 255],
[25, 25, 112, 255],
[147, 112, 219, 255],
[255, 255, 255, 255],
[72, 61, 139, 255],
[0, 206, 209, 255],
[175, 238, 238, 255],
[250, 240, 230, 255],
[112, 128, 144, 255],
[255, 182, 193, 255],
[224, 255, 255, 255],
[205, 133, 63, 255],
[245, 245, 220, 255],
[205, 92, 92, 255],
[255, 222, 173, 255],
[0, 128, 0, 255],
[173, 216, 230, 255],
[102, 205, 170, 255],
[152, 251, 152, 255],
[135, 206, 235, 255],
[148, 0, 211, 255],
[255, 20, 147, 255],
[0, 139, 139, 255],
[255, 218, 185, 255],
[0, 0, 128, 255],
[85, 107, 47, 255],
[230, 230, 250, 255],
[250, 250, 210, 255],
[255, 228, 181, 255],
[0, 191, 255, 255],
[178, 34, 34, 255],
[248, 248, 255, 255],
[240, 255, 240, 255],
[64, 224, 208, 255],
[153, 50, 204, 255],
[221, 160, 221, 255],
[211, 211, 211, 255],
[210, 105, 30, 255],
[176, 196, 222, 255],
[255, 228, 196, 255],
[0, 0, 205, 255],
[240, 248, 255, 255],
[240, 128, 128, 255],
[119, 136, 153, 255],
[0, 100, 0, 255],
[245, 255, 250, 255],
[255, 127, 80, 255],
[139, 0, 139, 255],
[255, 228, 225, 255],
[245, 245, 245, 255],
[255, 160, 122, 255],
[199, 21, 133, 255],
[255, 99, 71, 255],
[75, 0, 130, 255],
[165, 42, 42, 255],
[124, 252, 0, 255],
[95, 158, 160, 255],
[238, 130, 238, 255],
[255, 0, 255, 255],
[0, 0, 139, 255],
[255, 165, 0, 255],
[60, 179, 113, 255],
[0, 255, 0, 255],
[0, 0, 255, 255],
[139, 0, 0, 255],
[138, 43, 226, 255],
[255, 239, 213, 255],
[255, 235, 205, 255],
[46, 139, 87, 255],
[70, 130, 180, 255],
[255, 245, 238, 255],
[255, 240, 245, 255],
[255, 250, 240, 255],
[144, 238, 144, 255],
[233, 150, 122, 255],
[0, 0, 0, 255],
[220, 20, 60, 255],
[255, 105, 180, 255],
[47, 79, 79, 255],
[219, 112, 147, 255],
[253, 245, 230, 255],
[169, 169, 169, 255],
[128, 128, 0, 255],
[238, 232, 170, 255],
[176, 224, 230, 255],
[255, 192, 203, 255],
[255, 69, 0, 255],
[255, 255, 240, 255],
[0, 128, 128, 255],
[0, 255, 255, 255],
[184, 134, 11, 255],
[65, 105, 225, 255],
[244, 164, 96, 255],
[240, 230, 140, 255],
[218, 165, 32, 255],
[154, 205, 50, 255],
];
#[inline]
fn weak_hash(key: u32, salt: u32, n: usize) -> usize {
let y = key.wrapping_add(salt).wrapping_mul(2654435769);
let y = y ^ key;
(((y as u64) * (n as u64)) >> 32) as usize
}
pub(crate) fn lookup_palette_index(s: &str) -> Option<usize> {
let mut key = 0_u32;
for b in s.as_bytes() {
key = key.wrapping_mul(9).wrapping_add(*b as u32);
}
let salt = SALTS[weak_hash(key, 0, SALTS.len())] as u32;
let ix = weak_hash(key, salt, SALTS.len());
if s == NAMES[ix] {
Some(ix)
} else {
None
}
}