cosmeticIntermediatenewmc 1.20.x – 1.21.x55 lines
hex gradient chat text
send chat messages with smooth hex-color gradients (think rainbow ranks or fade-from-red-to-yellow). Skript 2.7+ supports the syntax — this template wraps it in a reusable function.
vanilla Skriptno addons required.
gradient-text.sk55 lines
# Skript 2.7+ supports inline hex via "<##rrggbb>", but writing a gradient # by hand is tedious — this function interpolates between two hex colors across # the length of the message and returns the formatted string. # # Usage: # send gradient("VICTORY ROYALE", "#ff0040", "#ffaa00") to player # Pass colors as 7-character CSS hex strings with a leading # (e.g. #ff0040 or #FF0040). function hexToInt(s: string) :: number: # Converts a 2-character hex string (e.g. "ff" or "FF") to an integer. # Uses a character-scan loop — no non-existent Skript parse expression needed. set {_s} to lowercase of {_s} set {_hex} to "0123456789abcdef" set {_hi} to 0 set {_lo} to 0 loop 16 times: if character at loop-number in {_hex} is (first 1 characters of {_s}): set {_hi} to loop-number - 1 if character at loop-number in {_hex} is (last 1 characters of {_s}): set {_lo} to loop-number - 1 return {_hi} * 16 + {_lo} function intToHex(n: number) :: string: set {_hex} to "0123456789abcdef" set {_hi} to character at (floor({_n} / 16) + 1) in {_hex} set {_lo} to character at (mod({_n}, 16) + 1) in {_hex} return "%{_hi}%%{_lo}%" function gradient(text: string, from: string, to: string) :: string: set {_len} to length of {_text} if {_len} <= 1: set {_col} to characters 2 to 7 of {_from} return "<##%{_col}%>%{_text}%" set {_r1} to hexToInt(characters 2 to 3 of {_from}) set {_g1} to hexToInt(characters 4 to 5 of {_from}) set {_b1} to hexToInt(characters 6 to 7 of {_from}) set {_r2} to hexToInt(characters 2 to 3 of {_to}) set {_g2} to hexToInt(characters 4 to 5 of {_to}) set {_b2} to hexToInt(characters 6 to 7 of {_to}) set {_out} to "" loop {_len} times: set {_t} to (loop-number - 1) / ({_len} - 1) set {_r} to round({_r1} + ({_r2} - {_r1}) * {_t}) set {_g} to round({_g1} + ({_g2} - {_g1}) * {_t}) set {_b} to round({_b1} + ({_b2} - {_b1}) * {_t}) set {_char} to character at loop-number in {_text} set {_out} to "%{_out}%<##%intToHex({_r})%%intToHex({_g})%%intToHex({_b})%>%{_char}%" return {_out} # Example usage — paste this and run /gradtest in-game command /gradtest: trigger: send gradient("VICTORY ROYALE", "#ff0040", "#ffaa00") to player send gradient("Welcome to the server!", "#00ffff", "#ff00ff") to player
get it running
gradient-text.sk · 55 lines · vanilla Skript- 1
copy or download
grab the .sk file with the buttons up top.
gradient-text.sk· ready to drop in - 2
drop it in your scripts folder
save it exactly here on your server — no typos, just copy the path:
…/plugins/Skript/scripts/gradient-text.sk - 3
reload in-game
run this in chat or console — your script goes live instantly:
/sk reload gradient-text
that's it — your script is live. hop in-game to try it.
/ related templates
more cosmetic templates
cosmetic
custom death messages
replace the default death messages with custom colored variants. different message per damage type (pvp, fall, lava, drown, etc.)
cosmeticevent countdown bossbar
display a server-wide bossbar counting down to a timed event. color shifts from green → yellow → red as time runs out.
cosmeticfloating damage numbers
spawns colored damage numbers above entities when hit. critical hits in gold/bold, low damage in gray, headshots in red.