diff --git a/colors.json b/colors.json index c6f3832..a0b02cf 100644 --- a/colors.json +++ b/colors.json @@ -305,7 +305,7 @@ }, "DASH-COLOR" : { - "_comment" : "Special background color for dash", + "_comment" : "Special background color for dash and for panel buttons with floating buttons tweak", "light" : { "s" : 40, @@ -630,7 +630,7 @@ "dark": { "s": 5, "l": 10, "a": 0.9 } }, - "BUTTON-CLOSE-COLOR" : { + "ACCENT-DISABLED-OPAQUE-COLOR": { "_comment" : "Same as ACCENT-DISABLED-COLOR, but has no transparency", "light" : { @@ -645,7 +645,7 @@ "a" : 1 } }, - "BUTTON-CLOSE_HOVER" : { + "ACCENT-DISABLED-OPAQUE_HOVER": { "_comment" : "Same as ACCENT-DISABLED_HOVER, but has no transparency", "light" : { diff --git a/theme/gnome-shell/.css/screenshot.css b/theme/gnome-shell/.css/screenshot.css index 6077ce5..7f697bd 100644 --- a/theme/gnome-shell/.css/screenshot.css +++ b/theme/gnome-shell/.css/screenshot.css @@ -185,7 +185,7 @@ .window-close, /* close button (Overview - Workspaces - Selected window) */ .screenshot-ui-close-button { /* close button (Screenshot UI) */ - background-color: BUTTON-CLOSE-COLOR; + background-color: ACCENT-DISABLED-OPAQUE-COLOR; color: TEXT-PRIMARY-COLOR; border: 1px solid BORDER-SHADOW; border-radius: 99px; @@ -195,5 +195,5 @@ .window-close:hover, .screenshot-ui-close-button:hover { - background-color: BUTTON-CLOSE_HOVER; + background-color: ACCENT-DISABLED-OPAQUE_HOVER; } \ No newline at end of file diff --git a/tweaks/opaque/tweak.py b/tweaks/opaque/tweak.py index 232c2ac..b2f2f9a 100755 --- a/tweaks/opaque/tweak.py +++ b/tweaks/opaque/tweak.py @@ -1,4 +1,4 @@ -from scripts.install.colors_definer import ColorsDefiner +from scripts.utils.theme.theme import Theme def define_arguments(parser): @@ -6,7 +6,10 @@ def define_arguments(parser): color_args.add_argument('-O', '--opaque', action='store_true', help='make the background in menus/popovers opaque') -def apply_tweak(args, theme, colors: ColorsDefiner): +def apply_tweak(args, theme: Theme, colors): if args.opaque: - colors.replacers["BACKGROUND-COLOR"]["light"]["a"] = 1 - colors.replacers["BACKGROUND-COLOR"]["dark"]["a"] = 1 + with open(theme.main_styles, "r") as file: + content = file.read() + with open(theme.main_styles, "w") as file: + replaced_content = content.replace("BACKGROUND-COLOR", "BACKGROUND-OPAQUE-COLOR") + file.write(replaced_content) \ No newline at end of file diff --git a/tweaks/panel/floating-panel-opaque.css b/tweaks/panel/floating-panel-opaque.css new file mode 100644 index 0000000..92cb204 --- /dev/null +++ b/tweaks/panel/floating-panel-opaque.css @@ -0,0 +1,4 @@ +.panel-button, +.panel-button .clock { + background-color: ACCENT-DISABLED-OPAQUE-COLOR; +} \ No newline at end of file diff --git a/tweaks/panel/floating-panel.css b/tweaks/panel/floating-panel.css new file mode 100644 index 0000000..219dda0 --- /dev/null +++ b/tweaks/panel/floating-panel.css @@ -0,0 +1,33 @@ +#panel { + background-color: transparent; +} + +#panel:overview { + background-color: BACKGROUND-OPAQUE-COLOR; +} + +.panel-button, +.panel-button .clock { + background-color: DASH-COLOR; + border-color: BORDER-MENU-SHADOW !important; +} + +.panel-button:hover, +.panel-button:hover .clock, +.panel-button:active, +.panel-button:active .clock { + background-color: ACCENT-DISABLED-OPAQUE_HOVER; +} + +#panel:overview .panel-button, +#panel:overview .panel-button .clock { + background-color: ACCENT-DISABLED-COLOR; + border-color: BORDER-SHADOW !important; +} + +#panel:overview .panel-button:hover, +#panel:overview .panel-button:hover .clock, +#panel:overview .panel-button:active, +#panel:overview .panel-button:active .clock { + background-color: ACCENT-DISABLED_HOVER; +} \ No newline at end of file diff --git a/tweaks/panel/text-color.css b/tweaks/panel/text-color.css new file mode 100644 index 0000000..d1bdd03 --- /dev/null +++ b/tweaks/panel/text-color.css @@ -0,0 +1,4 @@ +.panel-button, +.panel-button .clock { + color: REPLACEMENT-COLOR !important; +} \ No newline at end of file diff --git a/tweaks/panel/tweak.py b/tweaks/panel/tweak.py index a32af4f..29ebd1c 100755 --- a/tweaks/panel/tweak.py +++ b/tweaks/panel/tweak.py @@ -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") \ No newline at end of file + 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 \ No newline at end of file