ImbusBinds/Util.lua

52 lines
983 B
Lua
Raw Normal View History

2023-10-29 14:32:28 +01:00
local _, u = ...
-- Hex formatted as "AARRGGBB"
local COLOR = {
2024-08-16 12:48:16 +02:00
blue = 'FF' .. '0000FF',
green = 'FF' .. '00FF00',
red = 'FF' .. 'FF0000',
legendary = 'FF' .. 'A335EE',
heirloom = 'FF' .. 'E6CC80',
warning = 'FF' .. 'EED202',
2023-10-29 14:32:28 +01:00
}
-- Wrap the text in a color code
local function colorWrap(text, colorCode)
2024-08-16 12:48:16 +02:00
return '|c' .. colorCode .. text .. '|r'
2023-10-29 14:32:28 +01:00
end
-- Special case of the color function
local function prefix()
2024-08-16 12:48:16 +02:00
return colorWrap('ImbusBinds> ', COLOR.legendary)
2023-10-29 14:32:28 +01:00
end
-- Special print
local function bprint(msg)
2024-08-16 12:48:16 +02:00
print(prefix() .. msg)
2023-10-29 14:32:28 +01:00
end
-- Prints some separators
2024-08-16 12:48:16 +02:00
function u.guards()
local accum = ''
for _ = 1, 30 do
accum = accum .. '='
end
print(colorWrap(accum, COLOR.legendary))
2023-10-29 14:32:28 +01:00
end
function u.info(msg)
2024-08-16 12:48:16 +02:00
bprint(colorWrap(msg, COLOR.heirloom))
2023-10-29 14:32:28 +01:00
end
function u.warn(msg)
2024-08-16 12:48:16 +02:00
bprint(colorWrap(msg, COLOR.warning))
2023-10-29 14:32:28 +01:00
end
function u.error(msg)
2024-08-16 12:48:16 +02:00
bprint(colorWrap(msg, COLOR.red))
2023-10-29 14:32:28 +01:00
end
function u.success(msg)
2024-08-16 12:48:16 +02:00
bprint(colorWrap(msg, COLOR.green))
end