36 lines
1.6 KiB
TypeScript
36 lines
1.6 KiB
TypeScript
type ReturnType = `text-mc-${string}` | `bg-mc-${string}`
|
|
|
|
export function getColor(color?: string, type: "text" | "bg" = "text", defaultColor: "red" | "gray" = "red"): ReturnType {
|
|
switch (color) {
|
|
case "RED":
|
|
return type === "text" ? "text-mc-red" : "bg-mc-red"
|
|
case "GOLD":
|
|
return type === "text" ? "text-mc-gold" : "bg-mc-gold"
|
|
case "LIME":
|
|
return type === "text" ? "text-mc-green" : "bg-mc-green"
|
|
case "YELLOW":
|
|
return type === "text" ? "text-mc-yellow" : "bg-mc-yellow"
|
|
case "LIGHT_PURPLE":
|
|
return type === "text" ? "text-mc-light-purple" : "bg-mc-light-purple"
|
|
case "WHITE":
|
|
return type === "text" ? "text-mc-white" : "bg-mc-white"
|
|
case "BLUE":
|
|
return type === "text" ? "text-mc-blue" : "bg-mc-blue"
|
|
case "GREEN":
|
|
return type === "text" ? "text-mc-green" : "bg-mc-green"
|
|
case "DARK_RED":
|
|
return type === "text" ? "text-mc-dark-red" : "bg-mc-dark-red"
|
|
case "DARK_GREEN":
|
|
return type === "text" ? "text-mc-dark-green" : "bg-mc-dark-green"
|
|
case "DARK_PURPLE":
|
|
return type === "text" ? "text-mc-dark-purple" : "bg-mc-dark-purple"
|
|
case "DARK_GRAY":
|
|
return type === "text" ? "text-mc-dark-gray" : "bg-mc-dark-gray"
|
|
case "BLACK":
|
|
return type === "text" ? "text-mc-black" : "bg-mc-black"
|
|
case "DARK_BLUE":
|
|
return type === "text" ? "text-mc-dark-blue" : "bg-mc-dark-blue"
|
|
default:
|
|
return type === "text" ? `text-mc-${defaultColor}` : `bg-mc-${defaultColor}`
|
|
}
|
|
} |