Search Unity

Stepped Gradient Color Background

Discussion in 'UGUI & TextMesh Pro' started by Jayno, Mar 28, 2018.

  1. Jayno

    Jayno

    Joined:
    Feb 20, 2013
    Posts:
    5
    Hi all.

    I'm curious about best practices or a "Unity approach" to recreating the stepped-gradient-color-background of the text UI, in this screenshot.

    I'm newer to Unity, and I was wondering if there is a script based solution to this? Or a shader based solution? Or an image combined with a script based "re-tinting" type of solution?

    Thank you for your time and insight.
     
  2. Jayno

    Jayno

    Joined:
    Feb 20, 2013
    Posts:
    5
  3. Drapan

    Drapan

    Joined:
    Apr 9, 2013
    Posts:
    14
    The simplest solution is probably just a greyscale texture which then can be tinted in the default image component. Examples below. The colored one is simply tinting the first one with #5858B0.
    upload_2018-3-30_23-52-2.png upload_2018-3-30_23-52-51.png

    As you said, it can also be done with both scripts and shaders. For script one could inherit from Graphic class and generate a quad per color band with vertex color interpolated for that band.