Skip to main content

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:

PREFIX : <https://ddw-doccorp.linked.data.world/d/sparql-function-sample-queries/>
PREFIX fn: <http://data.world/function/functions#>

SELECT (fn:color("red") as ?color)
{
}

Run query

Results:

Screen_Shot_2022-11-23_at_6_23_38_PM.png