function decimalToHexadecimal(number: number) :: string:
return ("00" if {_number} <= 0, else ("FF")) if {_number} is not between 0 and 255
return join (character at (mod((floor({_number} / 16)), 16) + 1) in "0123456789ABCDEF") and (character at ((mod({_number}, 16)) + 1) in "0123456789ABCDEF")
function gradient(input: string, startColor: numbers, endColor: numbers, wrapAmount: number = -1) :: string:
set {_delta} to 180 / ({_wrapAmount} if {_wrapAmount} > 0, else (length of uncolored {_input}) - 1)
set {_angle} to 90
loop length of {_input} times:
set {_character} to character at loop-value in {_input}
if {_character} or (character at (loop-value - 1) in {_input}) is "§":
if "abcdefklmnor0123456789" contains {_character}:
set {_format} to (join {_format} and "&%{_character}%") if {_character} is not "r", else ("")
continue
set {_startColorProportion} to (0.5 * (sin({_angle}) + 1))
set {_endColorProportion} to (0.5 * (sin({_angle} + 180) + 1))
set {_output} to join {_output}, "<##%decimalToHexadecimal(({_startColor::1} * {_startColorProportion}) + ({_endColor::1} * {_endColorProportion}))%%decimalToHexadecimal(({_startColor::2} * {_startColorProportion}) + ({_endColor::2} * {_endColorProportion}))%%decimalToHexadecimal(({_startColor::3} * {_startColorProportion}) + ({_endColor::3} * {_endColorProportion}))%>", {_format} and {_character}
add {_delta} to {_angle}
return colored {_output}
on chat:
if player has permission "moderator":
replace all "{GROUP}" with formatted gradient(colored "&lMODERATOR", (0, 204, 0), (0, 255, 204)) in chat format