From 59e1d8332530d70c0ed9fabd01b896b83efc72b5 Mon Sep 17 00:00:00 2001 From: Gordon Norman Squash Date: Sun, 29 Sep 2024 18:43:44 -0400 Subject: Draw tree view rows in alternating colours ('zebra stripes') NOTE: Please see the README and the file `data/zebra-stripes.css` for information on how to actually activate the zebra stripes. --- data/zebra-stripes.css | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'data/zebra-stripes.css') diff --git a/data/zebra-stripes.css b/data/zebra-stripes.css index 5f13d79..e89c09d 100644 --- a/data/zebra-stripes.css +++ b/data/zebra-stripes.css @@ -1,16 +1,31 @@ -/* TODO: This is currently unused, but when alternating treeview row colours - * are restored, this will be the default CSS code to activate them if the - * current theme doesn't provide its own code for this. +/* This file enables alternating light and dark row colours ('zebra stripes') + * in tree view widgets. These are general good default colours for light + * themes. You can enable zebra stripes by copying this file to your + * ~/.config/gtk-3.0/gtk.css file, or you can implement similar code in your + * theme CSS. + * + * Note the extra CSS selectors which theme only tree views with more than + * one column; generally speaking, zebra stripes are only necessary when the + * list or tree contains more than one column. If you really want zebra + * stripes on all tree views, regardless of column count, remove the extra + * selectors for ':not(.first):not(.last)', '.first:not(.last)', and + * ':not(.first).last'. */ -treeview:not(:selected).odd.sorted, -treeview:not(:selected).even:not(.sorted) +treeview.cell:not(.first):not(.last):not(:selected).odd.sorted, +treeview.cell.first:not(.last):not(:selected).odd.sorted, +treeview.cell:not(.first).last:not(:selected).odd.sorted, +treeview.cell:not(.first):not(.last):not(:selected).even:not(.sorted), +treeview.cell.first:not(.last):not(:selected).even:not(.sorted), +treeview.cell:not(.first).last:not(:selected).even:not(.sorted) { background: alpha(black, 0.07); } -treeview:not(:selected).even.sorted +treeview.cell:not(.first):not(.last):not(:selected).even.sorted, +treeview.cell.first:not(.last):not(:selected).even.sorted, +treeview.cell:not(.first).last:not(:selected).even.sorted { background: alpha(black, 0.13); } -- cgit