Skip to content

Commit

Permalink
OSC: compacted color string manipulation code
Browse files Browse the repository at this point in the history
  • Loading branch information
omar committed May 1, 2024
1 parent e7721ab commit a44ab19
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions player/lua/osc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ local osc_param = { -- calculated by osc_init()
}

function osc_color_convert(color)
return string.sub(color,6,7) .. string.sub(color,4,5) .. string.sub(color,2,3)
return color:sub(6,7) .. color:sub(4,5) .. color:sub(2,3)
end

local osc_styles = {
Expand Down Expand Up @@ -1752,7 +1752,7 @@ function validate_user_opts()
user_opts.held_element_color, user_opts.time_pos_outline_color,
}
for _,color in pairs(colors) do
if string.match(color, "^#%x%x%x%x%x%x$") == nil then
if color:find("^#%x%x%x%x%x%x$") == nil then
msg.warn("'" .. color .. "' is not a valid color")
end
end
Expand Down

0 comments on commit a44ab19

Please sign in to comment.