Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow themes to draw treeview rows in alternating colours #42

Merged
merged 2 commits into from Dec 30, 2021

Conversation

thesquash
Copy link
Contributor

@thesquash thesquash commented Dec 28, 2021

Closes: #41

This commit adds one or two of three style classes to each cell in a GtkTreeView. Cells in odd-numbered rows have an .odd style class, whereas even rows have an .even style class added to them. A cell in a column that is used to sort the GtkTreeView gets the .sorted style class. This way, themes can add special rules for .even rows so that they are darkened slightly compared to .odd rows, and cells in a .sorted column are shaded even further, perhaps.

Example:

treeview.view
{
  background-color: #ffffff;
}

treeview.view.even,
treeview.view.sorted.odd
{
  background-color: #e0e0e0;
}

treeview.view.sorted.even
{
  background-color: #d0d0d0;
}

Here's an example of GTK+ 3.24.30 with this patch applied and an appropriate theme:

zebra-stripes

This commit adds one or two of three style classes to each cell in
a GtkTreeView.  Cells in odd-numbered rows have an `.odd` style
class, whereas even rows have an `.even` style class added to them.
A cell in a column that is used to sort the GtkTreeView gets the
`.sorted` style class.  This way, themes can add special rules for
`.even` rows so that they are darkened slightly compared to `.odd`
rows, and cells in a `.sorted` column are shaded even further,
perhaps.

Example:

```
treeview.view
{
  background-color: #ffffff;
}

treeview.view.even,
treeview.view.sorted.odd
{
  background-color: #e0e0e0;
}

treeview.view.sorted.even
{
  background-color: #d0d0d0;
}
```
@lah7 lah7 linked an issue Dec 28, 2021 that may be closed by this pull request
@lah7 lah7 added the patch new Adds a new enhancement or feature label Dec 28, 2021
Copy link
Owner

@lah7 lah7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks! Nice to see its return after all these years!

I looked over a few themes, and created a wiki page with snippets for users to append. I'll add this to the README.

@lah7 lah7 merged commit 48ced04 into lah7:master Dec 30, 2021
lah7 added a commit that referenced this pull request Dec 30, 2021
@luigifab
Copy link
Contributor

luigifab commented Jan 5, 2022

This is a must have!

lah7 added a commit to lah7/Ambiant-MATE-Colours that referenced this pull request Jan 27, 2022
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
@luigifab
Copy link
Contributor

Is someone tried to split caja window?
I loose colors for the inactive part. Not sure if it's my incomplete styles or not.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch new Adds a new enhancement or feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request: Alternate colours in Treeview
3 participants