Spaces:
Paused
Paused
File size: 850 Bytes
3c3f089 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
const alphabet = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
];
const groupA = alphabet.slice(0, 5);
const groupB = alphabet.slice(5, 10);
const groupC = alphabet.slice(10, 15);
const groupD = alphabet.slice(15, 20);
const groupE = alphabet.slice(20, alphabet.length);
interface CreateColors {
value?: string;
}
export const createColors = ({ value }: CreateColors): string => {
const chart = value?.trim().charAt(0).toLowerCase() ?? "";
if (groupA.includes(chart)) return "#0ea5e9";
if (groupB.includes(chart)) return "#d946ef";
if (groupC.includes(chart)) return "#14b8a6";
if (groupD.includes(chart)) return "#ec4899";
if (groupE.includes(chart)) return "#eab308";
return "#10b981";
};
|