Narrow the remaining position, box and colour reads

Color.struct leaves every channel optional, so the rainbow command
declares its own fully populated colour.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
bbassie
2026-08-07 15:31:43 +00:00
co-authored by Claude Opus 5
parent 981eed7f34
commit b75e283fc0
3 changed files with 21 additions and 12 deletions
+10 -4
View File
@@ -6,6 +6,12 @@ local Commands = require("modules/exp_commands")
local format_player_name = Commands.format_player_name_locale
local format_text = Commands.format_rich_text_color
--- A colour with every channel set, Color.struct leaves them optional
--- @class ExpCommands_Rainbow.Color
--- @field r number
--- @field g number
--- @field b number
--- Wraps one component into the next
--- @param c1 number
--- @param c2 number
@@ -21,8 +27,8 @@ local function step_component(c1, c2)
end
--- Wraps all components of a colour ensuring it remains valid
--- @param color Color
--- @return Color
--- @param color ExpCommands_Rainbow.Color
--- @return ExpCommands_Rainbow.Color
local function step_color(color)
color.r, color.g = step_component(color.r, color.g)
color.g, color.b = step_component(color.g, color.b)
@@ -32,9 +38,9 @@ local function step_color(color)
end
--- Get the next colour in the rainbow by the given step
--- @param color Color
--- @param color ExpCommands_Rainbow.Color
--- @param step number
--- @return Color
--- @return ExpCommands_Rainbow.Color
local function next_color(color, step)
step = step or 0.1
local new_color = { r = 0, g = 0, b = 0 }