Skip to content

Commit

Permalink
Don't try to guess the nearest x256 color to a nil textcolor
Browse files Browse the repository at this point in the history
  • Loading branch information
fiendish committed Jul 21, 2023
1 parent d42143a commit eb4fb6a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions MUSHclient/worlds/plugins/aardwolf_colors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,15 @@ function StylesToColours (styles, dollarC_resets)
local bold = style.bold or (style.style and ((style.style % 2) == 1))
local text = string.gsub(style.text, CODE_PREFIX, PREFIX_ESCAPE)
local textcolor = style.textcolour
local code = style.fromx
or bold and client_color_to_bold_code[textcolor]
or client_color_to_dim_code[textcolor]
or client_color_to_xterm_code[textcolor]
or string.format(X3DIGIT_FORMAT,bgr_number_to_nearest_x256(textcolor))
local code = (
style.fromx
or textcolor and (
bold and client_color_to_bold_code[textcolor]
or client_color_to_dim_code[textcolor]
or client_color_to_xterm_code[textcolor]
or string.format(X3DIGIT_FORMAT, bgr_number_to_nearest_x256(textcolor))
)
)

if code and (lastcode ~= code) then
table.insert(line_parts, code)
Expand Down

0 comments on commit eb4fb6a

Please sign in to comment.