Skip to content

Commit

Permalink
Add additional CSS for gtk3-classic for Ambiant/Radiant-MATE
Browse files Browse the repository at this point in the history
Appends CSS for alternating treeview row colours, which will be visible
when gtk3-classic is installed. Only added for Ambiant-MATE &
Radiant-MATE themes, not Yaru-MATE.

Thanks again to:
lah7/gtk3-classic#42
  • Loading branch information
lah7 committed Jan 27, 2022
1 parent 7fd014a commit 698f5cc
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 11 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -127,6 +127,7 @@ themes even further:
| ---------------------- | -------------------- | ---------------------------- |
| `mono-osd-icons` | Ambiant/Radiant-MATE | [Use monochrome icons for OSD volume pop up (#14)](https://github.com/lah7/ubuntu-mate-colours/issues/14)
| `black-selected-text` | Ambiant/Radiant-MATE | [The selected text colour is black instead of white (#21)](https://github.com/lah7/ubuntu-mate-colours/issues/21)
| `gtk3-classic` | Ambiant/Radiant-MATE | [Append treeview alternating styling](https://github.com/lah7/gtk3-classic/wiki/Treeview:-Alternating-Colours-CSS) for use with the [gtk3-classic](https://github.com/lah7/gtk3-classic) project.

These are passed as a comma separated parameter to `--tweaks`.

Expand Down
21 changes: 19 additions & 2 deletions generate-ambiant-mate-colour.py
Expand Up @@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright (C) 2019-2021 Luke Horwell <code@horwell.me>
# Copyright (C) 2019-2022 Luke Horwell <code@horwell.me>
#

from modules.common import validate_colour_hex
Expand Down Expand Up @@ -514,7 +514,8 @@ def __init__(self):
"""
self.tweaks = {
"mono-osd-icons": [self.mono_osd_icons, "Use mono icons for the OSD volume pop up"],
"black-selected-text": [self.black_selected_text, "Change the selected text colour to black."]
"black-selected-text": [self.black_selected_text, "Change the selected text colour to black."],
"gtk3-classic": [self.gtk3_classic_extras, "Additional styling for gtk3-classic package"],
}

def perform_tweaks(self):
Expand Down Expand Up @@ -565,6 +566,22 @@ def black_selected_text(self):
# Remove shadow when hovering over menus - escaped for regex
replace_string("*.css", "text-shadow: 0 -1px shade \(\@selected_bg_color, 0\.7\)", "text-shadow: none")

def gtk3_classic_extras(self):
"""
Adds additional CSS for convenience with gtk3-classic, such as
alternating treeview rows.
"""
if not prop.build_theme:
return

os.chdir(prop.target_dir_theme)
with open("gtk-3.0/gtk.css", "a") as f:
f.write("\n@import url(\"gtk3-classic.css\");")

orig = os.path.join(prop.templates_dir, "gtk3-classic.css")
dest = os.path.join(prop.target_dir_theme, "gtk-3.0", "gtk3-classic.css")
shutil.copy(orig, dest)


# ------------------------------------------------
# Miscellaneous
Expand Down
18 changes: 9 additions & 9 deletions scripts/build.sh
Expand Up @@ -77,15 +77,15 @@ function build_yaru() {
for theme in "Ambiant-MATE" "Ambiant-MATE-Dark" "Radiant-MATE"; do
# Hex # Name Tweaks
# --------- -------- -------------------------------------
generate_ambiant "$theme" "#2DACD4" "Aqua" "mono-osd-icons"
generate_ambiant "$theme" "#5489CF" "Blue" "mono-osd-icons"
generate_ambiant "$theme" "#965024" "Brown" "mono-osd-icons"
generate_ambiant "$theme" "#E95420" "Orange" "mono-osd-icons"
generate_ambiant "$theme" "#E231A3" "Pink" "mono-osd-icons"
generate_ambiant "$theme" "#7E5BC5" "Purple" "mono-osd-icons"
generate_ambiant "$theme" "#CE3A3A" "Red" "mono-osd-icons"
generate_ambiant "$theme" "#1CB39F" "Teal" "mono-osd-icons"
generate_ambiant "$theme" "#DFCA25" "Yellow" "mono-osd-icons,black-selected-text"
generate_ambiant "$theme" "#2DACD4" "Aqua" "gtk3-classic,mono-osd-icons"
generate_ambiant "$theme" "#5489CF" "Blue" "gtk3-classic,mono-osd-icons"
generate_ambiant "$theme" "#965024" "Brown" "gtk3-classic,mono-osd-icons"
generate_ambiant "$theme" "#E95420" "Orange" "gtk3-classic,mono-osd-icons"
generate_ambiant "$theme" "#E231A3" "Pink" "gtk3-classic,mono-osd-icons"
generate_ambiant "$theme" "#7E5BC5" "Purple" "gtk3-classic,mono-osd-icons"
generate_ambiant "$theme" "#CE3A3A" "Red" "gtk3-classic,mono-osd-icons"
generate_ambiant "$theme" "#1CB39F" "Teal" "gtk3-classic,mono-osd-icons"
generate_ambiant "$theme" "#DFCA25" "Yellow" "gtk3-classic,mono-osd-icons,black-selected-text"
done

# Build Yaru-MATE variants
Expand Down
37 changes: 37 additions & 0 deletions templates/gtk3-classic.css
@@ -0,0 +1,37 @@
/*
* Additional styling for use with gtk3-classic
* https://github.com/lah7/gtk3-classic/wiki/Treeview:-Alternating-Colours-CSS
*/

/* Alternating treeview rows */
treeview.view {
background-color: @base_color;
color: @fg_color;
}

treeview.view.even,
treeview.view.sorted.odd {
background-color: shade(@base_color, 0.9);
}

treeview.view.sorted.even {
background-color: shade(@base_color, 0.8);
}

treeview.view:hover,
treeview.view.even:hover,
treeview.view.odd:hover {
background-color: shade(@selected_bg_color, 1.75);
}

treeview.view:selected,
treeview.view.odd:selected,
treeview.view.even:selected,
treeview.view.sorted:selected {
background-color: @selected_bg_color;
}

.caja-side-pane treeview.view:not(:selected) {
background-color: shade(@base_color, 0.925);
color: @fg_color;
}

0 comments on commit 698f5cc

Please sign in to comment.