--- title: "gradient" description: "Calculates a percentage given the three numeric arguments number, low, and high." --- # gradient > Calculates a percentage given the three numeric arguments number, low, and high. **This function is used by Ignition's Expression language.** ## Description 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. ## Syntax `gradient(value, low, high, lowColor, highColor)` ### Parameters | Type | Parameter | Description | |---|---|---| | 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 | `lowColow` | 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. ## Examples ```python title="Code Snippet" gradient(0, 0, 100, toColor("red"), toColor("blue")) //returns red. ``` ```python title="Code Snippet" gradient(100, 0, 100, toColor("red"), toColor("blue")) //returns blue. ``` ```python title="Code Snippet" gradient(60, 0, 100, toColor("red"), toColor("blue")) //returns a shade of purple. ``` ```python title="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. ```