aboutsummaryrefslogtreecommitdiff
path: root/builtin/common/misc_helpers.lua
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2020-12-12 14:06:41 +0100
committerElias Fleckenstein <eliasfleckenstein@web.de>2020-12-12 14:06:41 +0100
commita34c610938eb03f449bdb077e61414213e576ebc (patch)
tree17b6c63fed2ced4a2603d5dccd78ce5cca185d2b /builtin/common/misc_helpers.lua
parent7250cf2c1c29b685b8ac3552c296f11c8178b0a0 (diff)
downloaddragonfireclient-a34c610938eb03f449bdb077e61414213e576ebc.tar.xz
Make GitHub Actions Happy try 2
Diffstat (limited to 'builtin/common/misc_helpers.lua')
-rw-r--r--builtin/common/misc_helpers.lua37
1 files changed, 18 insertions, 19 deletions
diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua
index db94e7073..0fbb8fba8 100644
--- a/builtin/common/misc_helpers.lua
+++ b/builtin/common/misc_helpers.lua
@@ -596,22 +596,21 @@ function core.colorize(color, message)
end
local function rgb_to_hex(rgb)
- local hexadecimal = '#'
+ local hexadecimal = "#"
for key, value in pairs(rgb) do
- local hex = ''
+ local hex = ""
while(value > 0)do
local index = math.fmod(value, 16) + 1
value = math.floor(value / 16)
- hex = string.sub('0123456789ABCDEF', index, index) .. hex
+ hex = string.sub("0123456789ABCDEF", index, index) .. hex
end
if(string.len(hex) == 0)then
- hex = '00'
-
+ hex = "00"
elseif(string.len(hex) == 1)then
- hex = '0' .. hex
+ hex = "0" .. hex
end
hexadecimal = hexadecimal .. hex
@@ -623,21 +622,21 @@ end
local function color_from_hue(hue)
local h = hue / 60
local c = 255
- local x = (1 - math.abs(h%2 - 1)) * 255
+ local x = (1 - math.abs(h % 2 - 1)) * 255
- local i = math.floor(h);
- if (i == 0) then
+ local i = math.floor(h)
+ if i == 0 then
return rgb_to_hex({c, x, 0})
- elseif (i == 1) then
+ elseif i == 1 then
return rgb_to_hex({x, c, 0})
- elseif (i == 2) then
+ elseif i == 2 then
return rgb_to_hex({0, c, x})
- elseif (i == 3) then
- return rgb_to_hex({0, x, c});
- elseif (i == 4) then
- return rgb_to_hex({x, 0, c});
- else
- return rgb_to_hex({c, 0, x});
+ elseif i == 3 then
+ return rgb_to_hex({0, x, c})
+ elseif i == 4 then
+ return rgb_to_hex({x, 0, c})
+ else
+ return rgb_to_hex({c, 0, x})
end
end
@@ -646,11 +645,11 @@ function core.rainbow(input)
local hue = 0
local output = ""
for i = 1, input:len() do
- local char = input:sub(i,i)
+ local char = input:sub(i, i)
if char:match("%s") then
output = output .. char
else
- output = output .. core.get_color_escape_sequence(color_from_hue(hue)) .. char
+ output = output .. core.get_color_escape_sequence(color_from_hue(hue)) .. char
end
hue = hue + step
end