Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Question Changing style for elements using showAlternatingRowBackgrounds

Discussion in 'UI Toolkit' started by niel-archer, Sep 27, 2021.

  1. niel-archer

    niel-archer

    Joined:
    Nov 29, 2016
    Posts:
    17
    I have a ListView using the showAlternatingRowBackgrounds property, but the odd row's style is terrible (bad contrast/colour combination). Is it possible to redefine the style used either through uss or via the code?
     
  2. HugoBD-Unity

    HugoBD-Unity

    Unity Technologies

    Joined:
    May 14, 2018
    Posts:
    442
    Can you try overriding the background color of this uss class: ".unity-collection-view__item--alternative-background"
     
  3. niel-archer

    niel-archer

    Joined:
    Nov 29, 2016
    Posts:
    17
    Yes that did the trick. and .unity-collection-view__item to set the odd lines.

    Many thanks for your help, I never would have found those otherwise.
     
    Last edited: Sep 29, 2021
    HugoBD-Unity likes this.