Skip to content

Commit

Permalink
add transparent accent setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiko2k committed Jan 30, 2025
1 parent daafd83 commit 4df0124
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 11 deletions.
43 changes: 32 additions & 11 deletions src/tauon/t_modules/t_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3132,6 +3132,7 @@ def save_prefs():
cf.update_value("auto-scale", prefs.x_scale)
cf.update_value("tracklist-y-text-offset", prefs.tracklist_y_text_offset)
cf.update_value("theme-name", prefs.theme_name)
cf.update_value("transparent-style", prefs.transparent_mode)
cf.update_value("mac-style", prefs.macstyle)
cf.update_value("allow-art-zoom", prefs.zoom_art)

Expand Down Expand Up @@ -3377,6 +3378,7 @@ def load_prefs():
cf.add_text("[ui]")

prefs.theme_name = cf.sync_add("string", "theme-name", prefs.theme_name)
prefs.transparent_mode = cf.sync_add("int", "transparent-style", prefs.transparent_mode, "0=opaque(default), 1=accents")
macstyle = cf.sync_add("bool", "mac-style", prefs.macstyle, "Use macOS style window buttons")
prefs.zoom_art = cf.sync_add("bool", "allow-art-zoom", prefs.zoom_art)
prefs.gallery_row_scroll = cf.sync_add("bool", "scroll-gallery-by-row", True)
Expand Down Expand Up @@ -13220,8 +13222,7 @@ def display(self) -> None:

if self.stage == 1:

wop = rw_from_object(self.im)
s_image = sdl3.IMG_Load_RW(wop, 0)
s_image = ddt.load_image(self.im)

c = sdl3.SDL_CreateTextureFromSurface(renderer, s_image)

Expand Down Expand Up @@ -23279,6 +23280,20 @@ def toggle_auto_theme(mode: int = 0) -> None:
# if prefs.colour_from_image and prefs.art_bg and not key_shift_down:
# toggle_auto_bg()

def toggle_transparent_accent(mode: int= 0) -> bool | None:
if mode == 1:
return prefs.transparent_mode == 1

if prefs.transparent_mode == 1:
prefs.transparent_mode = 0
else:
prefs.transparent_mode = 1

gui.reload_theme = True
gui.update += 1
gui.pl_update += 1

return None

def toggle_auto_bg(mode: int= 0) -> bool | None:
if mode == 1:
Expand Down Expand Up @@ -27553,6 +27568,8 @@ def theme(self, x0, y0, w0, h0):

self.toggle_square(x, y, toggle_auto_bg, _("Use album art as background"))

self.toggle_square(x + round(280 * gui.scale), y, toggle_transparent_accent, _("Transparent accent"))

y += 23 * gui.scale

old = prefs.enable_fanart_bg
Expand Down Expand Up @@ -43976,15 +43993,6 @@ def drop_file(target):
# if focused is True:
# mouse_down = False

# TODO testing only, remove me later
# gg = 5
# aa = 80
# colours.top_panel_background = [gg,gg,gg,aa]
# colours.side_panel_background = [gg,gg,gg,aa]
# colours.bottom_panel_colour = [gg,gg,gg,aa]
# colours.playlist_panel_background = [gg,gg,gg,aa]
#colours.playlist_box_background = [0, 0, 0, 100]

if inp.media_key:
if inp.media_key == "Play":
if pctl.playing_state == 0:
Expand Down Expand Up @@ -44139,6 +44147,15 @@ def drop_file(target):
colours.post_config()
deco.unload()

if prefs.transparent_mode:
colours.top_panel_background[3] = 80
colours.side_panel_background[3] = 80
colours.art_box[3] = 100
colours.window_frame[3] = 100
colours.bottom_panel_colour[3] = 190
#colours.playlist_panel_background = aa
#colours.playlist_box_background = [0, 0, 0, 100]

prefs.theme_name = gui.theme_name

#logging.info("Theme number: " + str(theme))
Expand Down Expand Up @@ -47287,6 +47304,10 @@ def drop_file(target):

sdl3.SDL_SetRenderTarget(renderer, None)
if not gui.present:
sdl3.SDL_SetRenderDrawColor(
renderer, colours.top_panel_background[0], colours.top_panel_background[1],
colours.top_panel_background[2], colours.top_panel_background[3])
sdl3.SDL_RenderClear(renderer)
sdl3.SDL_RenderTexture(renderer, gui.main_texture, None, gui.tracklist_texture_rect)
gui.present = True

Expand Down
1 change: 1 addition & 0 deletions src/tauon/t_modules/t_prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ def __init__(

self.tracklist_y_text_offset = 0
self.theme_name = "Turbo"
self.transparent_mode: int = 0
self.left_panel_mode = "playlist"

self.folder_tree_codec_colours = False
Expand Down

0 comments on commit 4df0124

Please sign in to comment.