Reference/Functions/
COLOR
A function for constructing color values for use in displaying query results. COLOR can be called in three different ways. With one argument, COLOR can be used to specify a color as either three digit hex value (e.g. #fff) or as one of a set of pre-defined color values (black, white, red, green, blue, yellow, cyan, or magenta). Called with three arguments, COLOR interpolates between two colors, based on the value of it's first argument. In this case, the first argument should be a decimal value between 0 and 1, and the second and third arguments should be colors. Finally, COLOR can be called with five arguments. In that case the first three arguments should be decimal numbers defining a low value, a high value, and a value between them to interpolate. The fourth and fifth arguments should be the colors to be interpolated
Parameter | Type |
---|
arg1 | integer, string, double, decimal, color |
arg2 | integer, string, double, decimal, color |
arg3 | integer, string, double, decimal, color |
arg4 | integer, string, double, decimal, color |
arg5 | integer, string, double, decimal, color |
Returns: color
Example
query:
SELECT WITH_COLOR("dave", COLOR("blue")) as name
results:
name |
dave |
query: |
```SQL |
SELECT WITH_COLOR(“dave”, COLOR(“#00f”)) as name |
``` |
results: |
name |
dave |
query: |
```SQL |
SELECT WITH_COLOR(“dave”, COLOR(0.5, “blue”, “white”)) as name |
``` |
results: |
name |
dave |
query: |
```SQL |
SELECT WITH_COLOR(“dave”, COLOR(3, 1, 7, “blue”, “white”)) as name |
``` |
results: |