Search Unity

Color inheritance

Discussion in 'UI Toolkit' started by Devi-User, Nov 20, 2018.

  1. Devi-User

    Devi-User

    Joined:
    Apr 30, 2016
    Posts:
    61
    I want to create a list item that has an arrow and text.
    When I hover over this object, I would like to get a blue tint of this arrow.
    I set the arrow through the background-url, or I can ask via image if I use Image.
    I paint the background of the main container when I switch to the state: hover
    However, the arrow does not change its color. It seems that in uss there is no way to do this, since all the fields affecting the color do not allow changing the images.

    On the other hand, maybe I just did not find such a method and you can tell me how to achieve the result, as on IMGUI.
    In the end, the states of ala disabled should be somehow processed when there is a picture inside. I do not think that a separate image is created for such situations.
    uielements inherit color.png
     
  2. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,231
    Actually, we do have separate images for the different states of our icons. We don't really use tinting.

    What you're seeing on the IMGUI side is the image has some alpha so when the background changes color the arrow icon "appears" to tint, but it just lets some of the blue background display through. I don't think your UIElements image has the same alpha values. It "should" just work if it did.

    That said, I'm afraid you'll have to wait for 2019.1 for actual image tinting support in UIElements.
     
    Devi-User likes this.