library(highcharter)
## Highcharts (www.highcharts.com) is a Highsoft software product which is
## not free for commercial and Governmental use
library(tibble)
df <- rownames_to_column(mtcars)
df <- head(df)
df
##             rowname  mpg cyl disp  hp drat    wt  qsec vs am gear carb
## 1         Mazda RX4 21.0   6  160 110 3.90 2.620 16.46  0  1    4    4
## 2     Mazda RX4 Wag 21.0   6  160 110 3.90 2.875 17.02  0  1    4    4
## 3        Datsun 710 22.8   4  108  93 3.85 2.320 18.61  1  1    4    1
## 4    Hornet 4 Drive 21.4   6  258 110 3.08 3.215 19.44  1  0    3    1
## 5 Hornet Sportabout 18.7   8  360 175 3.15 3.440 17.02  0  0    3    2
## 6           Valiant 18.1   6  225 105 2.76 3.460 20.22  1  0    3    1
# note the argument is outside the hcaes
hchart(df, "column", hcaes(x = rowname, y = disp), color = '#000000')
hchart(df, "column", hcaes(x = rowname, y = disp), color = 'blue')
colors <- rep(c("#FF0000", "#FFFF00"), length.out = nrow(df))
colors
## [1] "#FF0000" "#FFFF00" "#FF0000" "#FFFF00" "#FF0000" "#FFFF00"
df$color_var <- colors
df
##             rowname  mpg cyl disp  hp drat    wt  qsec vs am gear carb
## 1         Mazda RX4 21.0   6  160 110 3.90 2.620 16.46  0  1    4    4
## 2     Mazda RX4 Wag 21.0   6  160 110 3.90 2.875 17.02  0  1    4    4
## 3        Datsun 710 22.8   4  108  93 3.85 2.320 18.61  1  1    4    1
## 4    Hornet 4 Drive 21.4   6  258 110 3.08 3.215 19.44  1  0    3    1
## 5 Hornet Sportabout 18.7   8  360 175 3.15 3.440 17.02  0  0    3    2
## 6           Valiant 18.1   6  225 105 2.76 3.460 20.22  1  0    3    1
##   color_var
## 1   #FF0000
## 2   #FFFF00
## 3   #FF0000
## 4   #FFFF00
## 5   #FF0000
## 6   #FFFF00
# if color argument have a hexadecimal pattern
hchart(df, "column", hcaes(x = rowname, y = disp, color = color_var))
# note the argument is inside the hcaes

# if not, color according a variable
hchart(df, "column", hcaes(x = rowname, y = disp, color = hp))
# note the argument is inside the hcaes