Skip to main content
Version: 8.1


This function is used by Ignition's Expression language.


Calculates a percentage given the three numeric arguments number, low, and high. Uses this percentage to create a color that is a mix between the two colors.


gradient(value, low, high, lowColor, highColor)

  • Parameters

    • Integer value - The value used to determine the percentage between the low and high values.

    • Integer low - The low value to use to calculate the percentage.

    • Integer high - The high value to use to calculate the percentage.

    • Color lowColor - The color that will match 0%.

      Color highColor - The color that will match 100%.

  • Results

    • Color - A color that is a mix of the two given colors based on the percentage.


Code Snippet
gradient(0, 0, 100, toColor("red"), toColor("blue")) //returns red.
Code Snippet
gradient(100, 0, 100, toColor("red"), toColor("blue")) //returns blue.
Code Snippet
gradient(60, 0, 100, toColor("red"), toColor("blue")) //returns a shade of purple.
Code Snippet
gradient({Root Container.Tank.value}, 0, 100, color(255,0,0), color(0,0,255)) //will return a gradient from red to blue based on the level of a tank.