Files
buzz-sheet/lib/catalog/rarity.ts
T
2026-10-02 22:12:43 +07:00

51 lines
2.2 KiB
TypeScript

const rarityGradientClasses: Record<number, string> = {
1: "bg-[#697177] bg-[linear-gradient(90deg,rgba(105,113,119,1)_0%,rgba(137,144,147,1)_100%)]",
2: "bg-[#5D8972] bg-[linear-gradient(90deg,rgba(93,137,114,1)_0%,rgba(121,167,127,1)_100%)]",
3: "bg-[#4D7691] bg-[linear-gradient(90deg,rgba(77,118,145,1)_0%,rgba(71,135,165,1)_100%)]",
4: "bg-[#6D6A9C] bg-[linear-gradient(90deg,rgba(109,106,156,1)_0%,rgba(150,122,179,1)_100%)]",
5: "bg-[#A67B34] bg-[linear-gradient(90deg,rgba(166,123,52,1)_0%,rgba(178,123,44,1)_100%)]",
};
const specialCharacterKeys = new Set(["10000062", "10000117", "10000118"]);
const specialCharacterGradientClass = "bg-[#9A424E] bg-[linear-gradient(90deg,#9A424E_0%,#B85D67_100%)]";
const rarityGradients: Record<number, string> = {
1: "linear-gradient(90deg, rgba(105, 113, 119, 1) 0%, rgba(137, 144, 147, 1) 100%)",
2: "linear-gradient(90deg, rgba(93, 137, 114, 1) 0%, rgba(121, 167, 127, 1) 100%)",
3: "linear-gradient(90deg, rgba(77, 118, 145, 1) 0%, rgba(71, 135, 165, 1) 100%)",
4: "linear-gradient(90deg, rgba(109, 106, 156, 1) 0%, rgba(150, 122, 179, 1) 100%)",
5: "linear-gradient(90deg, rgba(166, 123, 52, 1) 0%, rgba(178, 123, 44, 1) 100%)",
};
const rarityTextClasses: Record<number, string> = {
3: "text-[#4D7691]",
4: "text-[#6D6A9C]",
5: "text-[#A67B34]",
};
const rarityTextColors: Record<number, string> = {
3: "#4D7691",
4: "#6D6A9C",
5: "#A67B34",
};
export function rarityGradientClass(rarity: number | null | undefined): string | undefined {
return rarity ? rarityGradientClasses[rarity] : undefined;
}
export function characterRarityGradientClass(key: string | null | undefined, rarity: number | null | undefined): string | undefined {
return key && specialCharacterKeys.has(key) ? specialCharacterGradientClass : rarityGradientClass(rarity);
}
export function rarityGradient(rarity: number | null | undefined): string {
return (rarity && rarityGradients[rarity]) || "#17383d";
}
export function rarityTextClass(rarity: number | null | undefined): string | undefined {
return rarity ? rarityTextClasses[rarity] : undefined;
}
export function rarityTextColor(rarity: number | null | undefined): string {
return (rarity && rarityTextColors[rarity]) || "#17171c";
}