refactror
This commit is contained in:
@@ -1,77 +0,0 @@
|
||||
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 "GREEN":
|
||||
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 "DARK_GREEN":
|
||||
return type === "text" ? "text-mc-dark-green" : "bg-mc-dark-green"
|
||||
case "DARK_RED":
|
||||
return type === "text" ? "text-mc-dark-red" : "bg-mc-dark-red"
|
||||
case "DARK_AQUA":
|
||||
return type === "text" ? "text-mc-dark-aqua" : "bg-mc-dark-aqua"
|
||||
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"
|
||||
case "GRAY":
|
||||
return type === "text" ? "text-mc-gray" : "bg-mc-gray"
|
||||
default:
|
||||
return type === "text" ? `text-mc-${defaultColor}` : `bg-mc-${defaultColor}`
|
||||
}
|
||||
}
|
||||
|
||||
export function getColorFromCode(c?: string) {
|
||||
switch (c) {
|
||||
case "0":
|
||||
return "text-mc-black"
|
||||
case "1":
|
||||
return "text-mc-dark-blue"
|
||||
case "2":
|
||||
return "text-mc-dark-green"
|
||||
case "3":
|
||||
return "text-mc-dark-aqua"
|
||||
case "4":
|
||||
return "text-mc-dark-red"
|
||||
case "5":
|
||||
return "text-mc-dark-purple"
|
||||
case "6":
|
||||
return "text-mc-gold"
|
||||
case "7":
|
||||
return "text-mc-gray"
|
||||
case "8":
|
||||
return "text-mc-dark-gray"
|
||||
case "9":
|
||||
return "text-mc-blue"
|
||||
case "a":
|
||||
return "text-mc-green"
|
||||
case "b":
|
||||
return "text-mc-aqua"
|
||||
case "c":
|
||||
return "text-mc-red"
|
||||
case "d":
|
||||
return "text-mc-light-purple"
|
||||
case "e":
|
||||
return "text-mc-yellow"
|
||||
case "f":
|
||||
return "text-mc-white"
|
||||
default:
|
||||
return "text-mc-gray"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user