The gplots package has a function named col2hex():
library(gplots)
col2hex("gold1")
"#FFD700"
Answer from GordonShumway on Stack OverflowRapidTables
rapidtables.com › web › color › RGB_Color.html
RGB Color Codes Chart 🎨
RGB color codes chart, RGB color picker, RGB color table.
RGB Color Picker
rgbcolorpicker.com
RGB Color Picker
The intensity of each color is represented with a value from 0-255, where 0 is the lowest intensity and 255 is the highest. RGB is an additive color model, meaning that light emitted from the display adds colors together to create a desired color. When all three colors are combined at their maximum intensity (255 each), they produce white.
Videos
How To Find Color Codes in Photoshop - HEX, CMYK, RGB ...
01:19
How to Find RGB Values of a Color using MS Paint - YouTube
03:39
Coding for Beginners: The RGB Color System - YouTube
Understanding RGB Colors
15:37
Hexadecimal color codes explanation | how to convert from rgb to ...
04:06
What Are RGB Codes For Common Colors? - Graphic Design Nerd - YouTube
RapidTables
rapidtables.com › convert › color › rgb-to-hex.html
RGB to Hex Color Converter
Hex to RGB converter ► · Convert the red, green and blue color values from decimal to hex. Concatenate the 3 hex values of the red, green and blue togather: RRGGBB. Convert red color (255,0,0) to hex color code: R = 25510 = FF16 · G = 010 = 0016 · B = 010 = 0016 ·
HTML Color Codes
htmlcolorcodes.com
HTML Color Codes
Get HTML color codes, Hex color codes, RGB, HSL and OKLCH values with our color pickers, color wheel, color chart and HTML color names. Let's go!
W3Schools
w3schools.com › colors › colors_rgb.asp
Colors RGB and RGBA
Each parameter (red, green, and blue) defines the intensity of the color with a value between 0 and 255. For example, rgb(255, 0, 0) is displayed as red, because red is set to its highest value (255), and the other two (green and blue) are set to 0.
Top answer 1 of 2
5
The gplots package has a function named col2hex():
library(gplots)
col2hex("gold1")
"#FFD700"
2 of 2
4
First, you're talking about the hex representation, not the RGB. The RGB representation is three numbers (either between 0 and 1 or 0 and 255) giving the red, green, and blue levels.
To get the RGB representation, you can just use the base function col2rgb():
col2rgb('mediumorchid2')
# [,1]
# red 209
# green 95
# blue 238
I have long had a personal convenience function for getting the hex representation, as it's a task I need to do often:
col2hex <- function(x, alpha = "ff") {
RGB <- col2rgb(x)
return(apply(RGB, 2, function(C) {
paste(c("#", sprintf("%02x", C), alpha), collapse = "")
}))
}
col2hex('mediumorchid2')
# [1] "#d15feeff"
Update:
Gordon Shumway's excellent answer mentions that apparently there is a package with such a function already! I would recommend that. However, I leave my answer up both for the discussion of RGB vs. hex and in case you don't want a dependency on gplot.
W3Schools
w3schools.com › colors › colors_picker.asp
HTML Color Picker
Colors HOME Color Names Color Values Color Groups Color Shades Color Picker Color Mixer Color Converter Color RGB Color HEX Color HSL Color HWB Color CMYK Color NCol Color Gradient Color Theory Color Wheels Color currentcolor Color Hues Color Schemes Color Palettes Color Brands Color W3.CSS Color Metro UI Color Win8 Color Flat UI Color Psychology
RapidTables
rapidtables.com › convert › color › hex-to-rgb.html
Hex to RGB Color Converter
Convert red hex color code FF0000 to RGB color: Hex = FF0000 · So the RGB colors are: R = FF16 = 25510 · G = 0016 = 010 · B = 0016 = 010 · Or · RGB = (255, 0, 0) Convert gold hex color code FFD700 to RGB color: Hex = FFD700 · So the RGB colors are: R = FF16 = 25510 ·
Wikipedia
en.wikipedia.org › wiki › RGB_color_spaces
RGB color spaces - Wikipedia
6 days ago - Both xyY and uʹ,vʹ are derived from the CIE 1931 color space, a device independent space also known as XYZ which covers the full gamut of human-perceptible colors visible to the CIE 2° standard observer. RGB color spaces are well-suited to describing the electronic display of color, such as computer monitors and color television.
Color Hex
color-hex.com › popular-colors.php
Popular Colors
Popular Colors · List of most favorited colors by our users · #ff80ed 4578 · #065535 1232 · #000000 1079 · #133337 822 · #ffc0cb 744 · #ffffff 648 · #008080 597 · #ffe4e1 595
RGB.to
rgb.to
Convert Hex color #af0e55 to Rgb, Pantone, RAL, HSL, HSV, HSB, JSON. Get color scheme.
HEX color #af0e55 to RGB, Pantone, RAL, HSL and HSB formats. Convert it to JSON format and generate color schemes for your design.
meyerweb
meyerweb.com › eric › tools › color-blend
Color Blender
The Color Blender is licensed under a Creative Commons Attribution-ShareAlike 1.0 License · This tool is provided without warranty, guarantee, or much in the way of explanation. Note that use of this tool may or may not crash your browser, lock up your machine, erase your hard drive, or e-mail ...
RGBA Color Picker
rgbacolorpicker.com
RGBA Color Picker
RGB 565 is an alternative representation of RGB colors that uses 16 bits to represent the color: 5 bits for red, 6 bits for green, and 5 bits for blue. This color space is used in some embedded systems, such as microcontrollers.
Seaborn
seaborn.pydata.org › tutorial › color_palettes.html
Choosing color palettes — seaborn 0.13.2 documentation
The return value is an object that wraps a list of RGB tuples with a few useful methods, such as conversion to hex codes and a rich HTML representation. Calling color_palette() with no arguments will return the current default color palette that matplotlib (and most seaborn functions) will use if colors are not otherwise specified.