Fix color utilitiees: fix colorspec_to_table annotation, change ColorString & ColorSpec type (class -> alias)

This commit is contained in:
Van
2026-01-14 16:42:25 +03:00
parent 138ceae165
commit d5d4fec0c3
2 changed files with 3 additions and 3 deletions

View File

@@ -365,5 +365,5 @@ function minetest.colorspec_to_bytes(colorspec) end
--- Converts a ColorSpec into RGBA table form. If the ColorSpec is invalid, returns nil. You can use this to parse ColorStrings. --- Converts a ColorSpec into RGBA table form. If the ColorSpec is invalid, returns nil. You can use this to parse ColorStrings.
--- @param colorspec ColorSpec The ColorSpec to convert. --- @param colorspec ColorSpec The ColorSpec to convert.
--- @return {r:number, g:number, b:string, a:number}? --- @return {r:number, g:number, b:number, a:number}?
function minetest.colorspec_to_table(colorspec) end function minetest.colorspec_to_table(colorspec) end

View File

@@ -6,7 +6,7 @@
--- * an RGB or RGBA hex color code, e.g. `"#RRGGBB"` or `"#RRGGBBAA"`, where `RR`, `GG`, `BB`, and `AA` are two-digit hexadecimal numbers representing the red, green, blue, and alpha (opacity) components of the color. --- * an RGB or RGBA hex color code, e.g. `"#RRGGBB"` or `"#RRGGBBAA"`, where `RR`, `GG`, `BB`, and `AA` are two-digit hexadecimal numbers representing the red, green, blue, and alpha (opacity) components of the color.
--- * e.g. `"#FF0000"` for red, `"#00FF00"` for green, `"#0000FF"` for blue, etc. --- * e.g. `"#FF0000"` for red, `"#00FF00"` for green, `"#0000FF"` for blue, etc.
--- * a shorthand hex color code, e.g. `"#RGB"` or `"#RGBA"`, where `R`, `G`, `B`, and `A` are single-digit hexadecimal numbers representing the red, green, blue, and alpha (opacity) components of the color. --- * a shorthand hex color code, e.g. `"#RGB"` or `"#RGBA"`, where `R`, `G`, `B`, and `A` are single-digit hexadecimal numbers representing the red, green, blue, and alpha (opacity) components of the color.
--- @class ColorString: string --- @alias ColorString string
@@ -17,4 +17,4 @@
--- `colorspec = 0xFF00FF00` --- `colorspec = 0xFF00FF00`
--- * string form: A ColorString (defined above): --- * string form: A ColorString (defined above):
--- `colorspec = "green"` --- `colorspec = "green"`
--- @class ColorSpec: {r:number, g:number, b:number, a:number}|ColorString|number --- @alias ColorSpec {r:number, g:number, b:number, a:number}|ColorString|number