Results 1 to 6 of 6

Thread: 18.04: How to get GTK 3 treeview alternating row colors?

  1. #1
    Join Date
    Jun 2016
    Beans
    2,825
    Distro
    Xubuntu

    18.04: How to get GTK 3 treeview alternating row colors?

    Using Xubuntu 18.04 with Greybird theme, and all the GTK 3 GtkTreeViews have all the rows white (gnome-system-monitor is one example). I would like to make the odd numbered rows a different background color, so that the treeviews are "zebra striped" / alternating row colors. What to put in ~/.config/gtk-3.0/gtk.css to achieve this?
    Xubuntu 22.04, ArchLinux ♦ System76 hardware, virt-manager/KVM, VirtualBox
    If your questions are resolved to your satisfaction, please use Thread Tools > "Mark this thread as solved..."

  2. #2
    Join Date
    Jun 2016
    Beans
    2,825
    Distro
    Xubuntu

    Re: 18.04: How to get GTK 3 treeview alternating row colors?

    bump
    Xubuntu 22.04, ArchLinux ♦ System76 hardware, virt-manager/KVM, VirtualBox
    If your questions are resolved to your satisfaction, please use Thread Tools > "Mark this thread as solved..."

  3. #3
    Join Date
    Mar 2017
    Beans
    1,018

    Re: 18.04: How to get GTK 3 treeview alternating row colors?

    I don't think you can with apps using gtk3.
    I can force a gtk2 app to use a different theme than my default
    but I don't think gtk3 supports the gtk2 alternate row colours.

  4. #4
    Join Date
    Dec 2018
    Beans
    Hidden!

    Re: 18.04: How to get GTK 3 treeview alternating row colors?

    You need to set rules-hint to true, it is still in gtk3 https://developer.gnome.org/gtk3/sta...kTreeView.html

    Not that I've tried it, but I believe it is still available.

  5. #5
    Join Date
    Jun 2016
    Beans
    2,825
    Distro
    Xubuntu

    Re: 18.04: How to get GTK 3 treeview alternating row colors?

    Quote Originally Posted by freemedia2018 View Post
    You need to set rules-hint to true, it is still in gtk3 https://developer.gnome.org/gtk3/sta...kTreeView.html

    Not that I've tried it, but I believe it is still available.
    I'm not writing a GTK 3 app. I'm looking to tweak the GTK 3 theme through ~/.config/gtk-3.0/gtk.css .

    The page you linked says -
    Do not use it just because you prefer the appearance of the ruled tree; that’s a question for the theme. Some themes will draw tree rows in alternating colors even when rules are turned off, and users who prefer that appearance all the time can choose those themes.
    What I would like to do is make the theme do exactly that, i.e. always draw tree rows in alternating row colors.
    Xubuntu 22.04, ArchLinux ♦ System76 hardware, virt-manager/KVM, VirtualBox
    If your questions are resolved to your satisfaction, please use Thread Tools > "Mark this thread as solved..."

  6. #6
    Join Date
    Dec 2018
    Beans
    Hidden!

    Re: 18.04: How to get GTK 3 treeview alternating row colors?

    Quote Originally Posted by halogen2 View Post
    I'm not writing a GTK 3 app. I'm looking to tweak the GTK 3 theme through ~/.config/gtk-3.0/gtk.css
    Most of the settings for GTK authors should have corresponding settings in your gtk config. It's like that for WebKit and I'm hoping this will translate into a gtk config setting for you. If I modify my own config to do what you want, I will be sure to let you know.

    This was in a response to someone saying that the setting didn't exist in GTK 3. I didn't try to refute that to be pedantic, I hoped it would encourage someone in this thread (possibly even you) to help you find the needing setting. If people think the setting doesn't exist (still a possibility) they're less likely to try to find it. But I figure it likely that it's still there. The page I linked to would probably give a hint if the name of the setting changed. It's still possible the app doesn't support the setting.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •