Convert a colour hex code to an English string that roughly describes its colour in terms of hue, saturation and lightness, like 'dark saturated azure'. Optionally plot a block with the colour that the hex code encodes. Optionally print to the console the hue, saturation and lightness graphs that best approximate that hex code.

dh_solve(hex_code, swatch = FALSE, graphs = FALSE, crayon = TRUE)

Arguments

hex_code

Character. A valid hex colour code starting with a hash mark (#). Characters must take the values 0 to 9 or A to F (case insensitive).

swatch

Logical. Print to a graphical device a plot of the colour represented by (three-digit) hex code? Defaults to FALSE.

graphs

Logical. Do you want to print the result and associated hue, saturation and lightness bar charts to the console? Defaults to FALSE.

crayon

Logical. Do you want to print to the console in colour, using the crayon package?

Value

A character string. Optionally some console output and a plot.

Examples

dh_solve("#08F", graphs = FALSE, swatch = FALSE)
#> [1] "middle saturated azure"