Today we are going to learn how to generate RGB color code using python. Nowadays the hex color code is very useful in any designing part. In CSS part color is used as RGB and Hex code format. In python, it is very easy to create/generate any random rgb value. Show Let’s go for the coding section: Random RGB Color value generate in pythonRequirement:
Related articles on random module :
Code: import random r = random.randint(0,255) g = random.randint(0,255) b = random.randint(0,255) rgb = [r,g,b] print('A Random RGB Value :',rgb) Output: A Random RGB Value : [236, 58, 44] Process: In this code at first, we import the random library to work. Then we generate three random integer number by using random.randint() function, which must be in between lower value 0 and upper value 255. And store the three value in ‘r’, ‘g’, ‘b’ variables. The attributeprint("\033[4;33m This is an underlined yellow text.\033[0m") print("\033[1;31;46m This is a bold, red text on a cyan background.\033[0m")2 returns a decimal value in the range (0,1), hence we are converting them to the range (0,255) by multiplying each of them with 255. To pass RGB color values to Python's Matplotlib eventplot, we can take the following steps Steps
Exampleimport numpy as np import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True pos = 10 * np.random.random(100) colors = [(0.75, 0.50, 0.25)] plt.eventplot(pos, orientation='horizontal', linelengths=0.75, color=colors) plt.show() OutputYou can change the R, G, B values inside colors to get different colors in the plot. Python Color Constants ModuleSee Python: Tips and Tricks for similar articles. For Pygame and other graphics work, it’s helpful to have color constants that hold the color RGB values. I couldn’t find anything like this, so I created a color_constants module that: The colors are shown in the table below and the full code is shown below that. *Thanks to cloford.com for all the color names. Written by Nat Dunn. Follow Nat on Twitter. Related Articles
Looking to improve your Python skills? Check out Webucator’s Python classes. For Pygame and other graphics work, it’s helpful to have color constants that hold the color RGB values. I couldn’t find anything like this, so I created a color_constants module that:
The colors are shown in the table below and the full code is shown below that. Color NameHex ValueRGB ValueSamplealiceblue#F0F8FFRGB(240,248,255) antiquewhite#FAEBD7RGB(250,235,215) antiquewhite1#FFEFDBRGB(255,239,219) antiquewhite2#EEDFCCRGB(238,223,204) antiquewhite3#CDC0B0RGB(205,192,176) antiquewhite4#8B8378RGB(139,131,120) aqua#00FFFFRGB(0,255,255) aquamarine1#7FFFD4RGB(127,255,212) aquamarine2#76EEC6RGB(118,238,198) aquamarine3#66CDAARGB(102,205,170) aquamarine4#458B74RGB(69,139,116) azure1#F0FFFFRGB(240,255,255) azure2#E0EEEERGB(224,238,238) azure3#C1CDCDRGB(193,205,205) azure4#838B8BRGB(131,139,139) banana#E3CF57RGB(227,207,87) beige#F5F5DCRGB(245,245,220) bisque1#FFE4C4RGB(255,228,196) bisque2#EED5B7RGB(238,213,183) bisque3#CDB79ERGB(205,183,158) bisque4#8B7D6BRGB(139,125,107) black#000000RGB(0,0,0) blanchedalmond#FFEBCDRGB(255,235,205) blue#0000FFRGB(0,0,255) blue2#0000EERGB(0,0,238) blue3#0000CDRGB(0,0,205) blue4#00008BRGB(0,0,139) blueviolet#8A2BE2RGB(138,43,226) brick#9C661FRGB(156,102,31) brown#A52A2ARGB(165,42,42) brown1#FF4040RGB(255,64,64) brown2#EE3B3BRGB(238,59,59) brown3#CD3333RGB(205,51,51) brown4#8B2323RGB(139,35,35) burlywood#DEB887RGB(222,184,135) burlywood1#FFD39BRGB(255,211,155) burlywood2#EEC591RGB(238,197,145) burlywood3#CDAA7DRGB(205,170,125) burlywood4#8B7355RGB(139,115,85) burntsienna#8A360FRGB(138,54,15) burntumber#8A3324RGB(138,51,36) cadetblue#5F9EA0RGB(95,158,160) cadetblue1#98F5FFRGB(152,245,255) cadetblue2#8EE5EERGB(142,229,238) cadetblue3#7AC5CDRGB(122,197,205) cadetblue4#53868BRGB(83,134,139) cadmiumorange#FF6103RGB(255,97,3) cadmiumyellow#FF9912RGB(255,153,18) carrot#ED9121RGB(237,145,33) chartreuse1#7FFF00RGB(127,255,0) chartreuse2#76EE00RGB(118,238,0) chartreuse3#66CD00RGB(102,205,0) chartreuse4#458B00RGB(69,139,0) chocolate#D2691ERGB(210,105,30) chocolate1#FF7F24RGB(255,127,36) chocolate2#EE7621RGB(238,118,33) chocolate3#CD661DRGB(205,102,29) chocolate4#8B4513RGB(139,69,19) cobalt#3D59ABRGB(61,89,171) cobaltgreen#3D9140RGB(61,145,64) coldgrey#808A87RGB(128,138,135) coral#FF7F50RGB(255,127,80) coral1#FF7256RGB(255,114,86) coral2#EE6A50RGB(238,106,80) coral3#CD5B45RGB(205,91,69) coral4#8B3E2FRGB(139,62,47) cornflowerblue#6495EDRGB(100,149,237) cornsilk1#FFF8DCRGB(255,248,220) cornsilk2#EEE8CDRGB(238,232,205) cornsilk3#CDC8B1RGB(205,200,177) cornsilk4#8B8878RGB(139,136,120) crimson#DC143CRGB(220,20,60) cyan2#00EEEERGB(0,238,238) cyan3#00CDCDRGB(0,205,205) cyan4#008B8BRGB(0,139,139) darkgoldenrod#B8860BRGB(184,134,11) darkgoldenrod1#FFB90FRGB(255,185,15) darkgoldenrod2#EEAD0ERGB(238,173,14) darkgoldenrod3#CD950CRGB(205,149,12) darkgoldenrod4#8B6508RGB(139,101,8) darkgray#A9A9A9RGB(169,169,169) darkgreen#006400RGB(0,100,0) darkkhaki#BDB76BRGB(189,183,107) darkolivegreen#556B2FRGB(85,107,47) darkolivegreen1#CAFF70RGB(202,255,112) darkolivegreen2#BCEE68RGB(188,238,104) darkolivegreen3#A2CD5ARGB(162,205,90) darkolivegreen4#6E8B3DRGB(110,139,61) darkorange#FF8C00RGB(255,140,0) darkorange1#FF7F00RGB(255,127,0) darkorange2#EE7600RGB(238,118,0) darkorange3#CD6600RGB(205,102,0) darkorange4#8B4500RGB(139,69,0) darkorchid#9932CCRGB(153,50,204) darkorchid1#BF3EFFRGB(191,62,255) darkorchid2#B23AEERGB(178,58,238) darkorchid3#9A32CDRGB(154,50,205) darkorchid4#68228BRGB(104,34,139) darksalmon#E9967ARGB(233,150,122) darkseagreen#8FBC8FRGB(143,188,143) darkseagreen1#C1FFC1RGB(193,255,193) darkseagreen2#B4EEB4RGB(180,238,180) darkseagreen3#9BCD9BRGB(155,205,155) darkseagreen4#698B69RGB(105,139,105) darkslateblue#483D8BRGB(72,61,139) darkslategray#2F4F4FRGB(47,79,79) darkslategray1#97FFFFRGB(151,255,255) darkslategray2#8DEEEERGB(141,238,238) darkslategray3#79CDCDRGB(121,205,205) darkslategray4#528B8BRGB(82,139,139) darkturquoise#00CED1RGB(0,206,209) darkviolet#9400D3RGB(148,0,211) deeppink1#FF1493RGB(255,20,147) deeppink2#EE1289RGB(238,18,137) deeppink3#CD1076RGB(205,16,118) deeppink4#8B0A50RGB(139,10,80) deepskyblue1#00BFFFRGB(0,191,255) deepskyblue2#00B2EERGB(0,178,238) deepskyblue3#009ACDRGB(0,154,205) deepskyblue4#00688BRGB(0,104,139) dimgray#696969RGB(105,105,105) dodgerblue1#1E90FFRGB(30,144,255) dodgerblue2#1C86EERGB(28,134,238) dodgerblue3#1874CDRGB(24,116,205) dodgerblue4#104E8BRGB(16,78,139) eggshell#FCE6C9RGB(252,230,201) emeraldgreen#00C957RGB(0,201,87) firebrick#B22222RGB(178,34,34) firebrick1#FF3030RGB(255,48,48) firebrick2#EE2C2CRGB(238,44,44) firebrick3#CD2626RGB(205,38,38) firebrick4#8B1A1ARGB(139,26,26) flesh#FF7D40RGB(255,125,64) floralwhite#FFFAF0RGB(255,250,240) forestgreen#228B22RGB(34,139,34) gainsboro#DCDCDCRGB(220,220,220) ghostwhite#F8F8FFRGB(248,248,255) gold1#FFD700RGB(255,215,0) gold2#EEC900RGB(238,201,0) gold3#CDAD00RGB(205,173,0) gold4#8B7500RGB(139,117,0) goldenrod#DAA520RGB(218,165,32) goldenrod1#FFC125RGB(255,193,37) goldenrod2#EEB422RGB(238,180,34) goldenrod3#CD9B1DRGB(205,155,29) goldenrod4#8B6914RGB(139,105,20) gray#808080RGB(128,128,128) gray1#030303RGB(3,3,3) gray10#1A1A1ARGB(26,26,26) gray11#1C1C1CRGB(28,28,28) gray12#1F1F1FRGB(31,31,31) gray13#212121RGB(33,33,33) gray14#242424RGB(36,36,36) gray15#262626RGB(38,38,38) gray16#292929RGB(41,41,41) gray17#2B2B2BRGB(43,43,43) gray18#2E2E2ERGB(46,46,46) gray19#303030RGB(48,48,48) gray2#050505RGB(5,5,5) gray20#333333RGB(51,51,51) gray21#363636RGB(54,54,54) gray22#383838RGB(56,56,56) gray23#3B3B3BRGB(59,59,59) gray24#3D3D3DRGB(61,61,61) gray25#404040RGB(64,64,64) gray26#424242RGB(66,66,66) gray27#454545RGB(69,69,69) gray28#474747RGB(71,71,71) gray29#4A4A4ARGB(74,74,74) gray3#080808RGB(8,8,8) gray30#4D4D4DRGB(77,77,77) gray31#4F4F4FRGB(79,79,79) gray32#525252RGB(82,82,82) gray33#545454RGB(84,84,84) gray34#575757RGB(87,87,87) gray35#595959RGB(89,89,89) gray36#5C5C5CRGB(92,92,92) gray37#5E5E5ERGB(94,94,94) gray38#616161RGB(97,97,97) gray39#636363RGB(99,99,99) gray4#0A0A0ARGB(10,10,10) gray40#666666RGB(102,102,102) gray42#6B6B6BRGB(107,107,107) gray43#6E6E6ERGB(110,110,110) gray44#707070RGB(112,112,112) gray45#737373RGB(115,115,115) gray46#757575RGB(117,117,117) gray47#787878RGB(120,120,120) gray48#7A7A7ARGB(122,122,122) gray49#7D7D7DRGB(125,125,125) gray5#0D0D0DRGB(13,13,13) gray50#7F7F7FRGB(127,127,127) gray51#828282RGB(130,130,130) gray52#858585RGB(133,133,133) gray53#878787RGB(135,135,135) gray54#8A8A8ARGB(138,138,138) gray55#8C8C8CRGB(140,140,140) gray56#8F8F8FRGB(143,143,143) gray57#919191RGB(145,145,145) gray58#949494RGB(148,148,148) gray59#969696RGB(150,150,150) gray6#0F0F0FRGB(15,15,15) gray60#999999RGB(153,153,153) gray61#9C9C9CRGB(156,156,156) gray62#9E9E9ERGB(158,158,158) gray63#A1A1A1RGB(161,161,161) gray64#A3A3A3RGB(163,163,163) gray65#A6A6A6RGB(166,166,166) gray66#A8A8A8RGB(168,168,168) gray67#ABABABRGB(171,171,171) gray68#ADADADRGB(173,173,173) gray69#B0B0B0RGB(176,176,176) gray7#121212RGB(18,18,18) gray70#B3B3B3RGB(179,179,179) gray71#B5B5B5RGB(181,181,181) gray72#B8B8B8RGB(184,184,184) gray73#BABABARGB(186,186,186) gray74#BDBDBDRGB(189,189,189) gray75#BFBFBFRGB(191,191,191) gray76#C2C2C2RGB(194,194,194) gray77#C4C4C4RGB(196,196,196) gray78#C7C7C7RGB(199,199,199) gray79#C9C9C9RGB(201,201,201) gray8#141414RGB(20,20,20) gray80#CCCCCCRGB(204,204,204) gray81#CFCFCFRGB(207,207,207) gray82#D1D1D1RGB(209,209,209) gray83#D4D4D4RGB(212,212,212) gray84#D6D6D6RGB(214,214,214) gray85#D9D9D9RGB(217,217,217) gray86#DBDBDBRGB(219,219,219) gray87#DEDEDERGB(222,222,222) gray88#E0E0E0RGB(224,224,224) gray89#E3E3E3RGB(227,227,227) gray9#171717RGB(23,23,23) gray90#E5E5E5RGB(229,229,229) gray91#E8E8E8RGB(232,232,232) gray92#EBEBEBRGB(235,235,235) gray93#EDEDEDRGB(237,237,237) gray94#F0F0F0RGB(240,240,240) gray95#F2F2F2RGB(242,242,242) gray97#F7F7F7RGB(247,247,247) gray98#FAFAFARGB(250,250,250) gray99#FCFCFCRGB(252,252,252) green#008000RGB(0,128,0) green1#00FF00RGB(0,255,0) green2#00EE00RGB(0,238,0) green3#00CD00RGB(0,205,0) green4#008B00RGB(0,139,0) greenyellow#ADFF2FRGB(173,255,47) honeydew1#F0FFF0RGB(240,255,240) honeydew2#E0EEE0RGB(224,238,224) honeydew3#C1CDC1RGB(193,205,193) honeydew4#838B83RGB(131,139,131) hotpink#FF69B4RGB(255,105,180) hotpink1#FF6EB4RGB(255,110,180) hotpink2#EE6AA7RGB(238,106,167) hotpink3#CD6090RGB(205,96,144) hotpink4#8B3A62RGB(139,58,98) indianred#CD5C5CRGB(205,92,92) indianred1#FF6A6ARGB(255,106,106) indianred2#EE6363RGB(238,99,99) indianred3#CD5555RGB(205,85,85) indianred4#8B3A3ARGB(139,58,58) indigo#4B0082RGB(75,0,130) ivory1#FFFFF0RGB(255,255,240) ivory2#EEEEE0RGB(238,238,224) ivory3#CDCDC1RGB(205,205,193) ivory4#8B8B83RGB(139,139,131) ivoryblack#292421RGB(41,36,33) khaki#F0E68CRGB(240,230,140) khaki1#FFF68FRGB(255,246,143) khaki2#EEE685RGB(238,230,133) khaki3#CDC673RGB(205,198,115) khaki4#8B864ERGB(139,134,78) lavender#E6E6FARGB(230,230,250) lavenderblush1#FFF0F5RGB(255,240,245) lavenderblush2#EEE0E5RGB(238,224,229) lavenderblush3#CDC1C5RGB(205,193,197) lavenderblush4#8B8386RGB(139,131,134) lawngreen#7CFC00RGB(124,252,0) lemonchiffon1#FFFACDRGB(255,250,205) lemonchiffon2#EEE9BFRGB(238,233,191) lemonchiffon3#CDC9A5RGB(205,201,165) lemonchiffon4#8B8970RGB(139,137,112) lightblue#ADD8E6RGB(173,216,230) lightblue1#BFEFFFRGB(191,239,255) lightblue2#B2DFEERGB(178,223,238) lightblue3#9AC0CDRGB(154,192,205) lightblue4#68838BRGB(104,131,139) lightcoral#F08080RGB(240,128,128) lightcyan1#E0FFFFRGB(224,255,255) lightcyan2#D1EEEERGB(209,238,238) lightcyan3#B4CDCDRGB(180,205,205) lightcyan4#7A8B8BRGB(122,139,139) lightgoldenrod1#FFEC8BRGB(255,236,139) lightgoldenrod2#EEDC82RGB(238,220,130) lightgoldenrod3#CDBE70RGB(205,190,112) lightgoldenrod4#8B814CRGB(139,129,76) lightgoldenrodyellow#FAFAD2RGB(250,250,210) lightgrey#D3D3D3RGB(211,211,211) lightpink#FFB6C1RGB(255,182,193) lightpink1#FFAEB9RGB(255,174,185) lightpink2#EEA2ADRGB(238,162,173) lightpink3#CD8C95RGB(205,140,149) lightpink4#8B5F65RGB(139,95,101) lightsalmon1#FFA07ARGB(255,160,122) lightsalmon2#EE9572RGB(238,149,114) lightsalmon3#CD8162RGB(205,129,98) lightsalmon4#8B5742RGB(139,87,66) lightseagreen#20B2AARGB(32,178,170) lightskyblue#87CEFARGB(135,206,250) lightskyblue1#B0E2FFRGB(176,226,255) lightskyblue2#A4D3EERGB(164,211,238) lightskyblue3#8DB6CDRGB(141,182,205) lightskyblue4#607B8BRGB(96,123,139) lightslateblue#8470FFRGB(132,112,255) lightslategray#778899RGB(119,136,153) lightsteelblue#B0C4DERGB(176,196,222) lightsteelblue1#CAE1FFRGB(202,225,255) lightsteelblue2#BCD2EERGB(188,210,238) lightsteelblue3#A2B5CDRGB(162,181,205) lightsteelblue4#6E7B8BRGB(110,123,139) lightyellow1#FFFFE0RGB(255,255,224) lightyellow2#EEEED1RGB(238,238,209) lightyellow3#CDCDB4RGB(205,205,180) lightyellow4#8B8B7ARGB(139,139,122) limegreen#32CD32RGB(50,205,50) linen#FAF0E6RGB(250,240,230) magenta#FF00FFRGB(255,0,255) magenta2#EE00EERGB(238,0,238) magenta3#CD00CDRGB(205,0,205) magenta4#8B008BRGB(139,0,139) manganeseblue#03A89ERGB(3,168,158) maroon#800000RGB(128,0,0) maroon1#FF34B3RGB(255,52,179) maroon2#EE30A7RGB(238,48,167) maroon3#CD2990RGB(205,41,144) maroon4#8B1C62RGB(139,28,98) mediumorchid#BA55D3RGB(186,85,211) mediumorchid1#E066FFRGB(224,102,255) mediumorchid2#D15FEERGB(209,95,238) mediumorchid3#B452CDRGB(180,82,205) mediumorchid4#7A378BRGB(122,55,139) mediumpurple#9370DBRGB(147,112,219) mediumpurple1#AB82FFRGB(171,130,255) mediumpurple2#9F79EERGB(159,121,238) mediumpurple3#8968CDRGB(137,104,205) mediumpurple4#5D478BRGB(93,71,139) mediumseagreen#3CB371RGB(60,179,113) mediumslateblue#7B68EERGB(123,104,238) mediumspringgreen#00FA9ARGB(0,250,154) mediumturquoise#48D1CCRGB(72,209,204) mediumvioletred#C71585RGB(199,21,133) melon#E3A869RGB(227,168,105) midnightblue#191970RGB(25,25,112) mint#BDFCC9RGB(189,252,201) mintcream#F5FFFARGB(245,255,250) mistyrose1#FFE4E1RGB(255,228,225) mistyrose2#EED5D2RGB(238,213,210) mistyrose3#CDB7B5RGB(205,183,181) mistyrose4#8B7D7BRGB(139,125,123) moccasin#FFE4B5RGB(255,228,181) navajowhite1#FFDEADRGB(255,222,173) navajowhite2#EECFA1RGB(238,207,161) navajowhite3#CDB38BRGB(205,179,139) navajowhite4#8B795ERGB(139,121,94) navy#000080RGB(0,0,128) oldlace#FDF5E6RGB(253,245,230) olive#808000RGB(128,128,0) olivedrab#6B8E23RGB(107,142,35) olivedrab1#C0FF3ERGB(192,255,62) olivedrab2#B3EE3ARGB(179,238,58) olivedrab3#9ACD32RGB(154,205,50) olivedrab4#698B22RGB(105,139,34) orange#FF8000RGB(255,128,0) orange1#FFA500RGB(255,165,0) orange2#EE9A00RGB(238,154,0) orange3#CD8500RGB(205,133,0) orange4#8B5A00RGB(139,90,0) orangered1#FF4500RGB(255,69,0) orangered2#EE4000RGB(238,64,0) orangered3#CD3700RGB(205,55,0) orangered4#8B2500RGB(139,37,0) orchid#DA70D6RGB(218,112,214) orchid1#FF83FARGB(255,131,250) orchid2#EE7AE9RGB(238,122,233) orchid3#CD69C9RGB(205,105,201) orchid4#8B4789RGB(139,71,137) palegoldenrod#EEE8AARGB(238,232,170) palegreen#98FB98RGB(152,251,152) palegreen1#9AFF9ARGB(154,255,154) palegreen2#90EE90RGB(144,238,144) palegreen3#7CCD7CRGB(124,205,124) palegreen4#548B54RGB(84,139,84) paleturquoise1#BBFFFFRGB(187,255,255) paleturquoise2#AEEEEERGB(174,238,238) paleturquoise3#96CDCDRGB(150,205,205) paleturquoise4#668B8BRGB(102,139,139) palevioletred#DB7093RGB(219,112,147) palevioletred1#FF82ABRGB(255,130,171) palevioletred2#EE799FRGB(238,121,159) palevioletred3#CD6889RGB(205,104,137) palevioletred4#8B475DRGB(139,71,93) papayawhip#FFEFD5RGB(255,239,213) peachpuff1#FFDAB9RGB(255,218,185) peachpuff2#EECBADRGB(238,203,173) peachpuff3#CDAF95RGB(205,175,149) peachpuff4#8B7765RGB(139,119,101) peacock#33A1C9RGB(51,161,201) pink#FFC0CBRGB(255,192,203) pink1#FFB5C5RGB(255,181,197) pink2#EEA9B8RGB(238,169,184) pink3#CD919ERGB(205,145,158) pink4#8B636CRGB(139,99,108) plum#DDA0DDRGB(221,160,221) plum1#FFBBFFRGB(255,187,255) plum2#EEAEEERGB(238,174,238) plum3#CD96CDRGB(205,150,205) plum4#8B668BRGB(139,102,139) powderblue#B0E0E6RGB(176,224,230) purple#800080RGB(128,0,128) purple1#9B30FFRGB(155,48,255) purple2#912CEERGB(145,44,238) purple3#7D26CDRGB(125,38,205) purple4#551A8BRGB(85,26,139) raspberry#872657RGB(135,38,87) rawsienna#C76114RGB(199,97,20) red1#FF0000RGB(255,0,0) red2#EE0000RGB(238,0,0) red3#CD0000RGB(205,0,0) red4#8B0000RGB(139,0,0) rosybrown#BC8F8FRGB(188,143,143) rosybrown1#FFC1C1RGB(255,193,193) rosybrown2#EEB4B4RGB(238,180,180) rosybrown3#CD9B9BRGB(205,155,155) rosybrown4#8B6969RGB(139,105,105) royalblue#4169E1RGB(65,105,225) royalblue1#4876FFRGB(72,118,255) royalblue2#436EEERGB(67,110,238) royalblue3#3A5FCDRGB(58,95,205) royalblue4#27408BRGB(39,64,139) salmon#FA8072RGB(250,128,114) salmon1#FF8C69RGB(255,140,105) salmon2#EE8262RGB(238,130,98) salmon3#CD7054RGB(205,112,84) salmon4#8B4C39RGB(139,76,57) sandybrown#F4A460RGB(244,164,96) sapgreen#308014RGB(48,128,20) seagreen1#54FF9FRGB(84,255,159) seagreen2#4EEE94RGB(78,238,148) seagreen3#43CD80RGB(67,205,128) seagreen4#2E8B57RGB(46,139,87) seashell1#FFF5EERGB(255,245,238) seashell2#EEE5DERGB(238,229,222) seashell3#CDC5BFRGB(205,197,191) seashell4#8B8682RGB(139,134,130) sepia#5E2612RGB(94,38,18) sgibeet#8E388ERGB(142,56,142) sgibrightgray#C5C1AARGB(197,193,170) sgichartreuse#71C671RGB(113,198,113) sgidarkgray#555555RGB(85,85,85) sgigray12#1E1E1ERGB(30,30,30) sgigray16#282828RGB(40,40,40) sgigray32#515151RGB(81,81,81) sgigray36#5B5B5BRGB(91,91,91) sgigray52#848484RGB(132,132,132) sgigray56#8E8E8ERGB(142,142,142) sgigray72#B7B7B7RGB(183,183,183) sgigray76#C1C1C1RGB(193,193,193) sgigray92#EAEAEARGB(234,234,234) sgigray96#F4F4F4RGB(244,244,244) sgilightblue#7D9EC0RGB(125,158,192) sgilightgray#AAAAAARGB(170,170,170) sgiolivedrab#8E8E38RGB(142,142,56) sgisalmon#C67171RGB(198,113,113) sgislateblue#7171C6RGB(113,113,198) sgiteal#388E8ERGB(56,142,142) sienna#A0522DRGB(160,82,45) sienna1#FF8247RGB(255,130,71) sienna2#EE7942RGB(238,121,66) sienna3#CD6839RGB(205,104,57) sienna4#8B4726RGB(139,71,38) silver#C0C0C0RGB(192,192,192) skyblue#87CEEBRGB(135,206,235) skyblue1#87CEFFRGB(135,206,255) skyblue2#7EC0EERGB(126,192,238) skyblue3#6CA6CDRGB(108,166,205) skyblue4#4A708BRGB(74,112,139) slateblue#6A5ACDRGB(106,90,205) slateblue1#836FFFRGB(131,111,255) slateblue2#7A67EERGB(122,103,238) slateblue3#6959CDRGB(105,89,205) slateblue4#473C8BRGB(71,60,139) slategray#708090RGB(112,128,144) slategray1#C6E2FFRGB(198,226,255) slategray2#B9D3EERGB(185,211,238) slategray3#9FB6CDRGB(159,182,205) slategray4#6C7B8BRGB(108,123,139) snow1#FFFAFARGB(255,250,250) snow2#EEE9E9RGB(238,233,233) snow3#CDC9C9RGB(205,201,201) snow4#8B8989RGB(139,137,137) springgreen#00FF7FRGB(0,255,127) springgreen1#00EE76RGB(0,238,118) springgreen2#00CD66RGB(0,205,102) springgreen3#008B45RGB(0,139,69) steelblue#4682B4RGB(70,130,180) steelblue1#63B8FFRGB(99,184,255) steelblue2#5CACEERGB(92,172,238) steelblue3#4F94CDRGB(79,148,205) steelblue4#36648BRGB(54,100,139) tan#D2B48CRGB(210,180,140) tan1#FFA54FRGB(255,165,79) tan2#EE9A49RGB(238,154,73) tan3#CD853FRGB(205,133,63) tan4#8B5A2BRGB(139,90,43) teal#008080RGB(0,128,128) thistle#D8BFD8RGB(216,191,216) thistle1#FFE1FFRGB(255,225,255) thistle2#EED2EERGB(238,210,238) thistle3#CDB5CDRGB(205,181,205) thistle4#8B7B8BRGB(139,123,139) tomato1#FF6347RGB(255,99,71) tomato2#EE5C42RGB(238,92,66) tomato3#CD4F39RGB(205,79,57) tomato4#8B3626RGB(139,54,38) turquoise#40E0D0RGB(64,224,208) turquoise1#00F5FFRGB(0,245,255) turquoise2#00E5EERGB(0,229,238) turquoise3#00C5CDRGB(0,197,205) turquoise4#00868BRGB(0,134,139) turquoiseblue#00C78CRGB(0,199,140) violet#EE82EERGB(238,130,238) violetred#D02090RGB(208,32,144) violetred1#FF3E96RGB(255,62,150) violetred2#EE3A8CRGB(238,58,140) violetred3#CD3278RGB(205,50,120) violetred4#8B2252RGB(139,34,82) warmgrey#808069RGB(128,128,105) wheat#F5DEB3RGB(245,222,179) wheat1#FFE7BARGB(255,231,186) wheat2#EED8AERGB(238,216,174) wheat3#CDBA96RGB(205,186,150) wheat4#8B7E66RGB(139,126,102) white#FFFFFFRGB(255,255,255) whitesmoke#F5F5F5RGB(245,245,245) yellow1#FFFF00RGB(255,255,0) yellow2#EEEE00RGB(238,238,0) yellow3#CDCD00RGB(205,205,0) yellow4#8B8B00RGB(139,139,0)color_constants.py
*Thanks to cloford.com for all the color names. How do I specify RGB color in Matplotlib?Matplotlib recognizes the following formats to specify a color:. an RGB or RGBA (red, green, blue, alpha) tuple of float values in closed interval [0, 1] (e.g., (0.1, 0.2, 0.5) or (0.1, 0.2, 0.5, 0.3) );. a hex RGB or RGBA string (e.g., '#0f0f0f' or '#0f0f0f80' ; case-insensitive);. Is there a RGB function in Python?Numpy, Matplotlib, and turtle are examples of Python libraries that can be used to generate a color. The RGB color system's three primary hues are red, green, and blue. Its value ranges from 0 to 255. These three colors can be combined to produce different colors.
How do you code colors in Python?Python colors. 'b'- blue.. 'c' - cyan.. 'g' - green.. 'k' - black.. 'm' - magenta.. 'r' - red.. 'w' - white.. 'y' - yellow.. How do I set RGB color?Calculation examples. White RGB Color. White RGB code = 255*65536+255*256+255 = #FFFFFF.. Blue RGB Color. Blue RGB code = 0*65536+0*256+255 = #0000FF.. Red RGB Color. Red RGB code = 255*65536+0*256+0 = #FF0000.. Green RGB Color. Green RGB code = 0*65536+255*256+0 = #00FF00.. Gray RGB Color. ... . Yellow RGB Color.. |