OpenBI Docs Buy

Color.Name OpenBI

The name of the named colour nearest to a colour, given as #RRGGBB or as red, green and blue.

Group: Images and colours. OpenBI’s own: Power Query M has no function of this name.

Syntax

Color.Name(color as any, optional green as nullable number, optional blue as nullable number) as nullable text
ParameterTypeDescription
coloranyThe colour as text, #RRGGBB, RRGGBB or #RGB; or its red, 0 to 255, when green and blue follow.
greennullable number
optional
The green, 0 to 255.
bluenullable number
optional
The blue, 0 to 255.

Returns

nullable text. The name, in lower case words ("steel blue"); null for a null colour.

Remarks

  • Nearness is measured as the eye sees it rather than by plain distance: reds and blues weigh differently depending on how red the colour is.
  • The names are those Image.Colors gives: CSS's and some more.

Compared with Power Query

An OpenBI function: Power Query has none like it, so a query that uses it runs in OpenBI only, not in Power BI Desktop or the Power BI service.

Examples

A colour by its code

Color.Name("#D89247")
"peru"

The same colour by its parts

Color.Name(216, 146, 71)
"peru"

A column of names

Table.AddColumn(#table({"Hex"}, {{"#4682B4"}, {"#FFD700"}, {"#2E8B57"}}), "Name", each Color.Name([Hex]))
HexName
#4682B4steel blue
#FFD700gold
#2E8B57sea green

Image.Colors, Image.Color, Table.AddColumn.

Last updated · OpenBI Studio 0.3.79