diff options
Diffstat (limited to 'player/lua/osc.lua')
-rw-r--r-- | player/lua/osc.lua | 79 |
1 files changed, 56 insertions, 23 deletions
diff --git a/player/lua/osc.lua b/player/lua/osc.lua index 467f58bea6..4718be44c1 100644 --- a/player/lua/osc.lua +++ b/player/lua/osc.lua @@ -60,6 +60,18 @@ local user_opts = { playlist_media_title = true, -- whether to use media titles as playlist entry names chapter_fmt = "Chapter: %s", -- chapter print format for seekbar-hover. "no" to disable unicodeminus = false, -- whether to use the Unicode minus sign character + + background_color = "#000000", -- background color of the osc + timecode_color = "#FFFFFF", -- color of the progress bar and time color + title_color = "#FFFFFF", -- color of the title + time_pos_color = "#FFFFFF", -- color of the timecode at hovered position + buttons_color = "#FFFFFF", -- color of big buttons, wc buttons, and bar small buttons + small_buttonsL_color = "#FFFFFF", -- color of left small buttons + small_buttonsR_color = "#FFFFFF", -- color of right small buttons + top_buttons_color = "#FFFFFF", -- color of top buttons + held_element_color = "#999999", -- color of an element while held down + + time_pos_outline_color = "#000000" -- color of the border timecodes in slimbox and TimePosBar } -- read options from config and command-line @@ -76,27 +88,31 @@ local osc_param = { -- calculated by osc_init() }, } +function osc_color_convert(color) + return color:sub(6,7) .. color:sub(4,5) .. color:sub(2,3) +end + local osc_styles = { - bigButtons = "{\\blur0\\bord0\\1c&HFFFFFF\\3c&HFFFFFF\\fs50\\fnmpv-osd-symbols}", - smallButtonsL = "{\\blur0\\bord0\\1c&HFFFFFF\\3c&HFFFFFF\\fs19\\fnmpv-osd-symbols}", + bigButtons = "{\\blur0\\bord0\\1c&H" .. osc_color_convert(user_opts.buttons_color) .. "\\3c&HFFFFFF\\fs50\\fnmpv-osd-symbols}", + smallButtonsL = "{\\blur0\\bord0\\1c&H" .. osc_color_convert(user_opts.small_buttonsL_color) .. "\\3c&HFFFFFF\\fs19\\fnmpv-osd-symbols}", smallButtonsLlabel = "{\\fscx105\\fscy105\\fn" .. mp.get_property("options/osd-font") .. "}", - smallButtonsR = "{\\blur0\\bord0\\1c&HFFFFFF\\3c&HFFFFFF\\fs30\\fnmpv-osd-symbols}", - topButtons = "{\\blur0\\bord0\\1c&HFFFFFF\\3c&HFFFFFF\\fs12\\fnmpv-osd-symbols}", - - elementDown = "{\\1c&H999999}", - timecodes = "{\\blur0\\bord0\\1c&HFFFFFF\\3c&HFFFFFF\\fs20}", - vidtitle = "{\\blur0\\bord0\\1c&HFFFFFF\\3c&HFFFFFF\\fs12\\q2}", - box = "{\\rDefault\\blur0\\bord1\\1c&H000000\\3c&HFFFFFF}", - - topButtonsBar = "{\\blur0\\bord0\\1c&HFFFFFF\\3c&HFFFFFF\\fs18\\fnmpv-osd-symbols}", - smallButtonsBar = "{\\blur0\\bord0\\1c&HFFFFFF\\3c&HFFFFFF\\fs28\\fnmpv-osd-symbols}", - timecodesBar = "{\\blur0\\bord0\\1c&HFFFFFF\\3c&HFFFFFF\\fs27}", - timePosBar = "{\\blur0\\bord".. user_opts.tooltipborder .."\\1c&HFFFFFF\\3c&H000000\\fs30}", - vidtitleBar = "{\\blur0\\bord0\\1c&HFFFFFF\\3c&HFFFFFF\\fs18\\q2}", - - wcButtons = "{\\1c&HFFFFFF\\fs24\\fnmpv-osd-symbols}", - wcTitle = "{\\1c&HFFFFFF\\fs24\\q2}", - wcBar = "{\\1c&H000000}", + smallButtonsR = "{\\blur0\\bord0\\1c&H" .. osc_color_convert(user_opts.small_buttonsR_color) .. "\\3c&HFFFFFF\\fs30\\fnmpv-osd-symbols}", + topButtons = "{\\blur0\\bord0\\1c&H" .. osc_color_convert(user_opts.top_buttons_color) .. "\\3c&HFFFFFF\\fs12\\fnmpv-osd-symbols}", + + elementDown = "{\\1c&H" .. osc_color_convert(user_opts.held_element_color) .."}", + timecodes = "{\\blur0\\bord0\\1c&H" .. osc_color_convert(user_opts.timecode_color) .. "\\3c&HFFFFFF\\fs20}", + vidtitle = "{\\blur0\\bord0\\1c&H" .. osc_color_convert(user_opts.title_color) .. "\\3c&HFFFFFF\\fs12\\q2}", + box = "{\\rDefault\\blur0\\bord1\\1c&H" .. osc_color_convert(user_opts.background_color) .. "\\3c&HFFFFFF}", + + topButtonsBar = "{\\blur0\\bord0\\1c&H" .. osc_color_convert(user_opts.top_buttons_color) .. "\\3c&HFFFFFF\\fs18\\fnmpv-osd-symbols}", + smallButtonsBar = "{\\blur0\\bord0\\1c&H" .. osc_color_convert(user_opts.buttons_color) .. "\\3c&HFFFFFF\\fs28\\fnmpv-osd-symbols}", + timecodesBar = "{\\blur0\\bord0\\1c&H" .. osc_color_convert(user_opts.timecode_color) .."\\3c&HFFFFFF\\fs27}", + timePosBar = "{\\blur0\\bord".. user_opts.tooltipborder .."\\1c&H" .. osc_color_convert(user_opts.time_pos_color) .. "\\3c&H" .. osc_color_convert(user_opts.time_pos_outline_color) .. "\\fs30}", + vidtitleBar = "{\\blur0\\bord0\\1c&H" .. osc_color_convert(user_opts.title_color) .. "\\3c&HFFFFFF\\fs18\\q2}", + + wcButtons = "{\\1c&H" .. osc_color_convert(user_opts.buttons_color) .. "\\fs24\\fnmpv-osd-symbols}", + wcTitle = "{\\1c&H" .. osc_color_convert(user_opts.title_color) .. "\\fs24\\q2}", + wcBar = "{\\1c&H" .. osc_color_convert(user_opts.background_color) .. "}", } -- internal states, do not touch @@ -1408,9 +1424,9 @@ layouts["slimbox"] = function () -- styles local styles = { - box = "{\\rDefault\\blur0\\bord1\\1c&H000000\\3c&HFFFFFF}", - timecodes = "{\\1c&HFFFFFF\\3c&H000000\\fs20\\bord2\\blur1}", - tooltip = "{\\1c&HFFFFFF\\3c&H000000\\fs12\\bord1\\blur0.5}", + box = "{\\rDefault\\blur0\\bord1\\1c&H" .. osc_color_convert(user_opts.background_color) .. "\\3c&HFFFFFF}", + timecodes = "{\\1c&H" .. osc_color_convert(user_opts.timecode_color) .. "\\3c&H" .. osc_color_convert(user_opts.time_pos_outline_color) .. "\\fs20\\bord2\\blur1}", + tooltip = "{\\1c&H" .. osc_color_convert(user_opts.time_pos_color).. "\\3c&H" .. osc_color_convert(user_opts.time_pos_outline_color) .. "\\fs12\\bord1\\blur0.5}", } @@ -1727,6 +1743,19 @@ function validate_user_opts() user_opts.windowcontrols_alignment .. "\". Ignoring.") user_opts.windowcontrols_alignment = "right" end + + local colors = { + user_opts.background_color, user_opts.top_buttons_color, + user_opts.small_buttonsL_color, user_opts.small_buttonsR_color, + user_opts.buttons_color, user_opts.title_color, + user_opts.timecode_color, user_opts.time_pos_color, + user_opts.held_element_color, user_opts.time_pos_outline_color, + } + for _, color in pairs(colors) do + if color:find("^#%x%x%x%x%x%x$") == nil then + msg.warn("'" .. color .. "' is not a valid color") + end + end end function update_options(list) @@ -1849,7 +1878,11 @@ function osc_init() ne.content = function () if mp.get_property("pause") == "yes" then - return ("\238\132\129") + if mp.get_property("play-direction", "forward") ~= "backward" then + return ("\238\132\129") + else + return ("\238\132\144") + end else return ("\238\128\130") end |