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
| Parameter | Type | Description |
|---|---|---|
color | any | The colour as text, #RRGGBB, RRGGBB or #RGB; or its red, 0 to 255, when green and blue follow. |
green | nullable number optional | The green, 0 to 255. |
blue | nullable 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.Colorsgives: 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]))
| Hex | Name |
|---|---|
| #4682B4 | steel blue |
| #FFD700 | gold |
| #2E8B57 | sea green |