feat: added controls to configurable opacity properties

Changes background opacity of control buttons. Default is `0`.

ref #722
This commit is contained in:
tomasklaen
2023-11-04 19:38:15 +01:00
parent c9826221d0
commit bd068c9cd0
3 changed files with 8 additions and 10 deletions

View File

@@ -148,15 +148,12 @@ font_scale=1
text_border=1.2 text_border=1.2
# Border radius of buttons, menus, and all other rectangles # Border radius of buttons, menus, and all other rectangles
border_radius=4 border_radius=4
# A comma delimited list of color overrides in RGB HEX format. # A comma delimited list of color overrides in RGB HEX format. Defaults:
# Defaults: foreground=ffffff,foreground_text=000000,background=000000,background_text=ffffff,curtain=111111, # foreground=ffffff,foreground_text=000000,background=000000,background_text=ffffff,curtain=111111,success=a5e075,error=ff616e
# success=a5e075,error=ff616e
color= color=
# A comma delimited list of opacity overrides for various UI element backgrounds and shapes. # A comma delimited list of opacity overrides for various UI element backgrounds and shapes.
# This does not affect any text, which is always rendered fully opaque. # This does not affect any text, which is always rendered fully opaque. Defaults:
# Defaults: timeline=0.9,position=1,chapters=0.8,slider=0.9,slider_gauge=1,speed=0.6,menu=1,submenu=0.4, # timeline=0.9,position=1,chapters=0.8,slider=0.9,slider_gauge=1,controls=0,speed=0.6,menu=1,submenu=0.4,border=1,title=1,tooltip=1,thumbnail=1,curtain=0.8,idle_indicator=0.8,audio_indicator=0.5,buffering_indicator=0.3
# border=1,title=1,tooltip=1,thumbnail=1,curtain=0.8,idle_indicator=0.8,audio_indicator=0.5,
# buffering_indicator=0.3
opacity= opacity=
# Use a faster estimation method instead of accurate measurement # Use a faster estimation method instead of accurate measurement
# setting this to `no` might have a noticeable impact on performance, especially in large menus. # setting this to `no` might have a noticeable impact on performance, especially in large menus.

View File

@@ -43,11 +43,11 @@ function Button:render()
local background = self.active and self.foreground or self.background local background = self.active and self.foreground or self.background
-- Background -- Background
if is_hover_or_active then if is_hover_or_active or config.opacity.controls > 0 then
ass:rect(self.ax, self.ay, self.bx, self.by, { ass:rect(self.ax, self.ay, self.bx, self.by, {
color = self.active and background or foreground, color = (self.active or not is_hover) and background or foreground,
radius = state.radius, radius = state.radius,
opacity = visibility * (self.active and 1 or 0.3), opacity = visibility * (self.active and 1 or (is_hover and 0.3 or config.opacity.controls)),
}) })
end end

View File

@@ -147,6 +147,7 @@ local config_defaults = {
chapters = 0.8, chapters = 0.8,
slider = 0.9, slider = 0.9,
slider_gauge = 1, slider_gauge = 1,
controls = 0,
speed = 0.6, speed = 0.6,
menu = 1, menu = 1,
submenu = 0.4, submenu = 0.4,