Takes a three-character hex colour shortcode and prints to the console a bar chart of the red (R), green (G) and blue (B) values using unicode blocks. This provides a quick visual assessment of the relative amounts of each colour expressed by the hex shortcode.

dh_graph(
hex_short,
text = NULL,
crayon = TRUE
)

## Arguments

hex_short

Character. A valid hex-colour shortcode starting with a hash mark (#) and followed by three alphanumeric characters, which must take the values 0 to 9 or A to F (case insensitive).

text

Character. An optional string to place above the plot. If NULL (default), then the shortcode will be automatically selected.

Logical. Add an optional value showing the relative rank of the RGB values (i.e. am indicator of hue)? A visual aid.

Logical. Add an optional bar showing where the range of the RGB values falls (i.e. am indicator of saturation)? A visual aid.

Logical. Add an optional bar showing where the mean of the RGB values falls (i.e. am indicator of lightness)? A visual aid.

crayon

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

## Value

Nothing. Prints to the console with cat() a bar chart.

## Details

The amount of red (R), green (G) and blue (B) is calculated on the basis that hex shortcodes contain one character for each colour. Since they're hexadecimal, they can take one of 16 possible values: 0 to 9 and then alphabetic characters from A to F (i.e. 10 to 15). That means that a shortcode of '#18F' has relative RGB values of 1, 8 and 16.

## Examples

dh_graph("#D83")
#> #D83
#> R ██████████████░░ H 3
#> G █████████░░░░░░░ H 2
#> B ████░░░░░░░░░░░░ H 1
#> S ░░░███████████░░
#> L ░░░░░░░░█░░░░░░░
#>