The following page provides R color tables by name and hexadecimal code. The tables can be downloaded for local reference or recreated with R code provided.
R Color Tables: By Name
A pdf file for the color name table can be downloaded here”
R Colors By Name (2373 downloads)
Click to enlarge
R Color Tables: By Hex Code
A pdf file for the hex code table can be downloaded here: R Colors by Hex Code (1471 downloads)
Table Code
The above tables where created using the following script.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# 1.Define R Color Data ---- # RGB codes color.rgb <- t(col2rgb(colors())) # Hexadecimal codes color.hex <- rgb(color.rgb[,1], color.rgb[,2], color.rgb[,3], maxColorValue = 255) # Text highlighting color.text <- ifelse(apply(color.rgb, 1, mean) > 127, "black", "white") # Consolidate color.df <- data.frame(name = colors(), red = color.rgb[, "red"], green = color.rgb[, "green"], blue = color.rgb[, "blue"], hex = color.hex, text = color.text) # 2.Plot R Colors By Name ---- # configure graphical device n.col <- 11 n.row <- 60 par(pin = c(11.692, 6.267), mai=c(0.5, 0.5, 0.5, 0.5)) # create plot plot(c(0, n.col), c(0, n.row), type = "n", bty = "n", ylab = "", xlab = "", axes = FALSE) title("R Colors By Name") for(i in 1:n.col){ color.count <- (i-1) * n.row color.mod <- length(colors()) - color.count y.val <- ifelse(color.mod < n.row, n.row - color.mod + 1, 1) color.names <- as(color.df[color.count + 1:n.row, "name"], "character") rect(i - 1, y.val - 0.5, i, n.row:y.val + 0.5, border = "black", col = color.names) text.color <- as(color.df[color.count + 1:n.row, "text"], "character") text(i-0.5, n.row:y.val, labels = color.names, cex = 0.5, col = text.color) } # 3.Plot R Colors By Hex Code ---- # create plot plot(c(0, n.col), c(0, n.row), type = "n", bty = "n", ylab = "", xlab = "", axes = FALSE) title("R Colors By Hex Code") for(i in 1:n.col){ color.count <- (i-1) * n.row color.mod <- length(colors()) - color.count y.val <- ifelse(color.mod < n.row, n.row-color.mod + 1, 1) color.names <- as(color.df[color.count + 1:n.row, "hex"], "character") rect(i - 1, y.val - 0.5, i, n.row:y.val + 0.5, border = "black", col = color.names) text.color <- as(color.df[color.count + 1:n.row, "text"], "character") text(i-0.5, n.row:y.val, labels = color.names, cex = 0.5, col = text.color) } # reset graphical device par(op) |
Thank you very much, I would appreciate if you also post the R colors as RGB and HSV values too, thanks Samuel