mirror of
https://github.com/imarkoff/Marble-shell-theme.git
synced 2025-11-24 06:26:03 -08:00
Floating panel tweak; Fixed opaque, panel text color tweaks
- Closes #57; - Added floating panel tweak. Supports opaque tweak; - Fixed an issue when opaque tweak does not apply to translucent background; - Fixed an issue when panel text color tweak does not apply to clock button correctly and defined color does not work in overview. Extracted panel text color tweak to another function; - Renamed BUTTON-CLOSE-COLOR to ACCENT-DISABLED-OPAQUE-COLOR;
This commit is contained in:
@@ -12,24 +12,38 @@ def define_arguments(parser):
|
||||
panel_args.add_argument('-Ptc', '--panel-text-color', type=str, nargs='?', help='custom panel HEX(A) text color')
|
||||
panel_args.add_argument('--wider-panel', action='store_true', help='make the panel wider')
|
||||
panel_args.add_argument('--panel-grouped-buttons', action='store_true', help='group panel buttons together')
|
||||
panel_args.add_argument('--floating-panel', action='store_true', help='make the panel floating (transparent background)')
|
||||
|
||||
|
||||
def apply_tweak(args, theme: Theme, colors):
|
||||
if args.panel_default_size:
|
||||
theme.add_from_file(f"{panel_folder}/def-size.css")
|
||||
|
||||
if args.floating_panel:
|
||||
theme.add_from_file(f"{panel_folder}/floating-panel.css")
|
||||
if args.opaque:
|
||||
theme.add_from_file(f"{panel_folder}/floating-panel-opaque.css")
|
||||
|
||||
if args.panel_no_pill:
|
||||
theme.add_from_file(f"{panel_folder}/no-pill.css")
|
||||
|
||||
if args.wider_panel:
|
||||
theme.add_from_file(f"{panel_folder}/wider-panel.css")
|
||||
|
||||
if args.panel_text_color:
|
||||
theme += ".panel-button,\
|
||||
.clock,\
|
||||
.clock-display StIcon {\
|
||||
color: rgba(" + ', '.join(map(str, ColorConverterImpl.hex_to_rgba(args.panel_text_color))) + ");\
|
||||
}"
|
||||
resolve_panel_text_color(theme, args.panel_text_color)
|
||||
|
||||
if args.panel_grouped_buttons:
|
||||
theme.add_from_file(f"{panel_folder}/grouped-buttons.css")
|
||||
theme.add_from_file(f"{panel_folder}/grouped-buttons.css")
|
||||
|
||||
|
||||
def resolve_panel_text_color(theme: Theme, argument_property):
|
||||
if not argument_property: return
|
||||
|
||||
(r, g, b, a) = ColorConverterImpl.hex_to_rgba(argument_property)
|
||||
final_color = f"rgba({r}, {g}, {b}, {a})"
|
||||
|
||||
with open(f"{panel_folder}/text-color.css", "r") as file:
|
||||
content = file.read()
|
||||
|
||||
replaced_content = content.replace("REPLACEMENT-COLOR", final_color)
|
||||
theme += replaced_content
|
||||
Reference in New Issue
Block a user