Voici un code pour parser le contenu d'un tableau wikipédia, en extraire deux colonnes (en l’occurrence, le nom de la couleur et son code RGB) et le convertir en 565 :
#Auteur : Le Gnu-Bricoleur #Site internet : http://www.gnu-bricoleur.net/index.php?article6/ecran-lcd-opensmart-et-couleurs-16-bits-565 #Parser le code Wikipedia : https://fr.wikipedia.org/wiki/Couleur_du_Web fichier = open("wiki", "r") toutesleslignes = fichier.readlines() listecouleurs = [] listergb = [] lister = [] listeg = [] listeb = [] listehexa = [] couleur = False for ligne in toutesleslignes[9:]: print ligne if couleur == True: couleur = False col = ligne.split(" || ") listergb.append(col[2]) if ligne[0] == "!": couleur = True col = ligne[2:].split(",") col2 = col[0].split(" ") listecouleurs.append(col2[0]) fichier.close() print listecouleurs # Convertir les couleurs en 16 bits 565 for elt in listergb: num = elt[4:] num = num[:-1] num2 = num.split(",") print num2 lister.append(num2[0]) listeg.append(num2[1][1:]) listeb.append(num2[2][1:]) for i in range(len(lister)): r = int(lister[i]) g = int(listeg[i]) b = int(listeb[i]) #r = 255 - int(r) #b = 255 - int(b) #g = 255 - int(g) #r = bin(r%32)[2:].zfill(5) #g = bin(g%64)[2:].zfill(6) #b = bin(b%32)[2:].zfill(5) r = int((r/255.0)*31) g = int((g/255.0)*63) b = int((b/255.0)*31) r = bin(r)[2:].zfill(5) g = bin(g)[2:].zfill(6) b = bin(b)[2:].zfill(5) binaire = r + g + b hexa = hex(int(binaire, 2))[2:].zfill(4) hexa = "0x" + hexa.upper() listehexa.append(hexa) fichier = open("couleurs.h", "w") for i in range(len(listecouleurs)): fichier.write("#define " + listecouleurs[i].upper() + " " + listehexa[i] + "\n") fichier.close
Voici le tableau :
{|class="wikitable" |- !scope="col"| Nom(s) de couleur !scope="col"| Échantillon !scope="col"| RGB (hex) !scope="col"| RGB (décimal) !scope="col"| HSL (° et %) !scope="col"| HSV (° et %) !scope="col"| CMYK (%) |- ! black |style="background:#000"| || <code>#000
|| rgb(0, 0, 0) || hsl(0, 0%, 0%) || hsv(0, 0%, 0%) || cmyk(0%, 0%, 0%, 100%)
! dimgray, dimgrey
style=“background:#696969” | | #696969 | rgb(105, 105, 105) | hsl(0, 0%, 41.2%) | hsv(0, 0%, 41.2%) | |||||
! gray, grey
style=“background:#808080” | | #808080 | rgb(128, 128, 128) | hsl(0, 0%, 50.2%) | hsv(0, 0%, 50.2%) | |||||
! darkgray, darkgrey
style=“background:#A9A9A9” | | #A9A9A9 | rgb(169, 169, 169) | hsl(0, 0%, 66.3%) | hsv(0, 0%, 66.3%) | |||||
! silver
style=“background:#C0C0C0” | | #C0C0C0 | rgb(192, 192, 192) | hsl(0, 0%, 75.3%) | hsv(0, 0%, 75.3%) | |||||
! lightgray, lightgrey
style=“background:#D3D3D3” | | #D3D3D3 | rgb(211, 211, 211) | hsl(0, 0%, 82.7%) | hsv(0, 0%, 82.7%) | |||||
! gainsboro
style=“background:#DCDCDC” | | #DCDCDC | rgb(220, 220, 220) | hsl(0, 0%, 86.3%) | hsv(0, 0%, 86.3%) | |||||
! whitesmoke
style=“background:#F5F5F5” | | #F5F5F5 | rgb(245, 245, 245) | hsl(0, 0%, 96.1%) | hsv(0, 0%, 96.1%) | |||||
! white
style=“background:#FFF” | | #FFF | rgb(255, 255, 255) | hsl(0, 0%, 100%) | hsv(0, 0%, 100%) | |||||
! maroon
style=“background:#800000” | | #800000 | rgb(128, 0, 0) | hsl(0, 100%, 25.1%) | hsv(0, 100%, 50.2%) | |||||
! darkred
style=“background:#8B0000” | | #8B0000 | rgb(139, 0, 0) | hsl(0, 100%, 27.3%) | hsv(0, 100%, 54.5%) | |||||
! red
style=“background:#F00” | | #F00 | rgb(255, 0, 0) | hsl(0, 100%, 50%) | hsv(0, 100%, 100%) | |||||
! firebrick
style=“background:#B22222” | | #B22222 | rgb(178, 34, 34) | hsl(0, 67.9%, 41.6%) | hsv(0, 80.9%, 69.8%) | |||||
! brown
style=“background:#A52A2A” | | #A52A2A | rgb(165, 42, 42) | hsl(0, 59.4%, 40.6%) | hsv(0, 74.5%, 64.7%) | |||||
! indianred
style=“background:#CD5C5C” | | #CD5C5C | rgb(205, 92, 92) | hsl(0, 53.1%, 58.2%) | hsv(0, 55.1%, 80.4%) | |||||
! lightcoral
style=“background:#F08080” | | #F08080 | rgb(240, 128, 128) | hsl(0, 78.9%, 72.2%) | hsv(0, 46.7%, 94.1%) | |||||
! rosybrown
style=“background:#BC8F8F” | | #BC8F8F | rgb(188, 143, 143) | hsl(0, 25.1%, 64.9%) | hsv(0, 23.9%, 73.7%) | |||||
! snow
style=“background:#FFFAFA” | | #FFFAFA | rgb(255, 250, 250) | hsl(0, 100%, 99%) | hsv(0, 2%, 100%) | |||||
! mistyrose
style=“background:#FFE4E1” | | #FFE4E1 | rgb(255, 228, 225) | hsl(6, 100%, 94.1%) | hsv(6, 11.8%, 100%) | |||||
! salmon
style=“background:#FA8072” | | #FA8072 | rgb(250, 128, 114) | hsl(6.2, 93.2%, 71.4%) | hsv(6.2, 54.4%, 98%) | |||||
! tomato
style=“background:#FF6347” | | #FF6347 | rgb(255, 99, 71) | hsl(9.1, 100%, 63.9%) | hsv(9.1, 72.2%, 100%) | |||||
! darksalmon
style=“background:#E9967A” | | #E9967A | rgb(233, 150, 122) | hsl(15.1, 71.6%, 69.6%) | hsv(15.1, 47.6%, 91.4%) | |||||
! coral
style=“background:#FF7F50” | | #FF7F50 | rgb(255, 127, 80) | hsl(16.1, 100%, 65.7%) | hsv(16.1, 68.6%, 100%) | |||||
! orangered
style=“background:#FF4500” | | #FF4500 | rgb(255, 69, 0) | hsl(16.2, 100%, 50%) | hsv(16.2, 100%, 100%) | |||||
! lightsalmon
style=“background:#FFA07A” | | #FFA07A | rgb(255, 160, 122) | hsl(17.1, 100%, 73.9%) | hsv(17.1, 52.2%, 100%) | |||||
! sienna
style=“background:#A0522D” | | #A0522D | rgb(160, 82, 45) | hsl(19.3, 56.1%, 40.2%) | hsv(19.3, 71.9%, 62.7%) | |||||
! seashell
style=“background:#FFF5EE” | | #FFF5EE | rgb(255, 245, 238) | hsl(24.7, 100%, 96.7%) | hsv(24.7, 6.7%, 100%) | |||||
! saddlebrown
style=“background:#8B4513” | | #8B4513 | rgb(139, 69, 19) | hsl(25, 75.9%, 31%) | hsv(25, 86.3%, 54.5%) | |||||
! chocolate
style=“background:#D2691E” | | #D2691E | rgb(210, 105, 30) | hsl(25, 75%, 47.1%) | hsv(25, 85.7%, 82.4%) | |||||
! sandybrown
style=“background:#F4A460” | | #F4A460 | rgb(244, 164, 96) | hsl(27.6, 87.1%, 66.7%) | hsv(27.6, 60.7%, 95.7%) | |||||
! peachpuff
style=“background:#FFDAB9” | | #FFDAB9 | rgb(255, 218, 185) | hsl(28.3, 100%, 86.3%) | hsv(28.3, 27.5%, 100%) | |||||
! peru
style=“background:#CD853F” | | #CD853F | rgb(205, 133, 63) | hsl(29.6, 58.7%, 52.5%) | hsv(29.6, 69.3%, 80.4%) | |||||
! linen
style=“background:#FAF0E6” | | #FAF0E6 | rgb(250, 240, 230) | hsl(30, 66.7%, 94.1%) | hsv(30, 8%, 98%) | |||||
! bisque
style=“background:#FFE4C4” | | #FFE4C4 | rgb(255, 228, 196) | hsl(32.5, 100%, 88.4%) | hsv(32.5, 23.1%, 100%) | |||||
! darkorange
style=“background:#FF8C00” | | #FF8C00 | rgb(255, 140, 0) | hsl(32.9, 100%, 50%) | hsv(32.9, 100%, 100%) | |||||
! burlywood
style=“background:#DEB887” | | #DEB887 | rgb(222, 184, 135) | hsl(33.8, 56.9%, 70%) | hsv(33.8, 39.2%, 87.1%) | |||||
! tan
style=“background:#D2B48C” | | #D2B48C | rgb(210, 180, 140) | hsl(34.3, 43.8%, 68.6%) | hsv(34.3, 33.3%, 82.4%) | |||||
! antiquewhite
style=“background:#FAEBD7” | | #FAEBD7 | rgb(250, 235, 215) | hsl(34.3, 77.8%, 91.2%) | hsv(34.3, 14%, 98%) | |||||
! navajowhite
style=“background:#FFDEAD” | | #FFDEAD | rgb(255, 222, 173) | hsl(35.9, 100%, 83.9%) | hsv(35.9, 32.2%, 100%) | |||||
! blanchedalmond
style=“background:#FFEBCD” | | #FFEBCD | rgb(255, 235, 205) | hsl(36, 100%, 90.2%) | hsv(36, 19.6%, 100%) | |||||
! papayawhip
style=“background:#FFEFD5” | | #FFEFD5 | rgb(255, 239, 213) | hsl(37.1, 100%, 91.8%) | hsv(37.1, 16.5%, 100%) | |||||
! moccasin
style=“background:#FFE4B5” | | #FFE4B5 | rgb(255, 228, 181) | hsl(38.1, 100%, 85.5%) | hsv(38.1, 29%, 100%) | |||||
! orange
style=“background:#FFA500” | | #FFA500 | rgb(255, 165, 0) | hsl(38.8, 100%, 50%) | hsv(38.8, 100%, 100%) | |||||
! wheat
style=“background:#F5DEB3” | | #F5DEB3 | rgb(245, 222, 179) | hsl(39.1, 76.7%, 83.1%) | hsv(39.1, 26.9%, 96.1%) | |||||
! oldlace
style=“background:#FDF5E6” | | #FDF5E6 | rgb(253, 245, 230) | hsl(39.1, 85.2%, 94.7%) | hsv(39.1, 9.1%, 99.2%) | |||||
! floralwhite
style=“background:#FFFAF0” | | #FFFAF0 | rgb(255, 250, 240) | hsl(40, 100%, 97.1%) | hsv(40, 5.9%, 100%) | |||||
! darkgoldenrod
style=“background:#B8860B” | | #B8860B | rgb(184, 134, 11) | hsl(42.7, 88.7%, 38.2%) | hsv(42.7, 94%, 72.2%) | |||||
! goldenrod
style=“background:#DAA520” | | #DAA520 | rgb(218, 165, 32) | hsl(42.9, 74.4%, 49%) | hsv(42.9, 85.3%, 85.5%) | |||||
! cornsilk
style=“background:#FFF8DC” | | #FFF8DC | rgb(255, 248, 220) | hsl(48, 100%, 93.1%) | hsv(48, 13.7%, 100%) | |||||
! gold
style=“background:#FFD700” | | #FFD700 | rgb(255, 215, 0) | hsl(50.6, 100%, 50%) | hsv(50.6, 100%, 100%) | |||||
! khaki
style=“background:#F0E68C” | | #F0E68C | rgb(240, 230, 140) | hsl(54, 76.9%, 74.5%) | hsv(54, 41.7%, 94.1%) | |||||
! lemonchiffon
style=“background:#FFFACD” | | #FFFACD | rgb(255, 250, 205) | hsl(54, 100%, 90.2%) | hsv(54, 19.6%, 100%) | |||||
! palegoldenrod
style=“background:#EEE8AA” | | #EEE8AA | rgb(238, 232, 170) | hsl(54.7, 66.7%, 80%) | hsv(54.7, 28.6%, 93.3%) | |||||
! darkkhaki
style=“background:#BDB76B” | | #BDB76B | rgb(189, 183, 107) | hsl(55.6, 38.3%, 58%) | hsv(55.6, 43.4%, 74.1%) | |||||
! olive
style=“background:#808000” | | #808000 | rgb(128, 128, 0) | hsl(60, 100%, 25.1%) | hsv(60, 100%, 50.2%) | |||||
! yellow
style=“background:#FF0” | | #FF0 | rgb(255, 255, 0) | hsl(60, 100%, 50%) | hsv(60, 100%, 100%) | |||||
! lightgoldenrodyellow
style=“background:#FAFAD2” | | #FAFAD2 | rgb(250, 250, 210) | hsl(60, 80%, 90.2%) | hsv(60, 16%, 98%) | |||||
! lightyellow
style=“background:#FFFFE0” | | #FFFFE0 | rgb(255, 255, 224) | hsl(60, 100%, 93.9%) | hsv(60, 12.2%, 100%) | |||||
! beige
style=“background:#F5F5DC” | | #F5F5DC | rgb(245, 245, 220) | hsl(60, 55.6%, 91.2%) | hsv(60, 10.2%, 96.1%) | |||||
! ivory
style=“background:#FFFFF0” | | #FFFFF0 | rgb(255, 255, 240) | hsl(60, 100%, 97.1%) | hsv(60, 5.9%, 100%) | |||||
! olivedrab
style=“background:#6B8E23” | | #6B8E23 | rgb(107, 142, 35) | hsl(79.6, 60.5%, 34.7%) | hsv(79.6, 75.4%, 55.7%) | |||||
! yellowgreen
style=“background:#9ACD32” | | #9ACD32 | rgb(154, 205, 50) | hsl(79.7, 60.8%, 50%) | hsv(79.7, 75.6%, 80.4%) | |||||
! darkolivegreen
style=“background:#556B2F” | | #556B2F | rgb(85, 107, 47) | hsl(82, 39%, 30.2%) | hsv(82, 56.1%, 42%) | |||||
! greenyellow
style=“background:#ADFF2F” | | #ADFF2F | rgb(173, 255, 47) | hsl(83.7, 100%, 59.2%) | hsv(83.7, 81.6%, 100%) | |||||
! chartreuse
style=“background:#7FFF00” | | #7FFF00 | rgb(127, 255, 0) | hsl(90.1, 100%, 50%) | hsv(90.1, 100%, 100%) | |||||
! lawngreen
style=“background:#7CFC00” | | #7CFC00 | rgb(124, 252, 0) | hsl(90.5, 100%, 49.4%) | hsv(90.5, 100%, 98.8%) | |||||
! darkgreen
style=“background:#006400” | | #006400 | rgb(0, 100, 0) | hsl(120, 100%, 19.6%) | hsv(120, 100%, 39.2%) | |||||
! green
style=“background:#008000” | | #008000 | rgb(0, 128, 0) | hsl(120, 100%, 25.1%) | hsv(120, 100%, 50.2%) | |||||
! lime
style=“background:#0F0” | | #0F0 | rgb(0, 255, 0) | hsl(120, 100%, 50%) | hsv(120, 100%, 100%) | |||||
! limegreen
style=“background:#32CD32” | | #32CD32 | rgb(50, 205, 50) | hsl(120, 60.8%, 50%) | hsv(120, 75.6%, 80.4%) | |||||
! forestgreen
style=“background:#228B22” | | #228B22 | rgb(34, 139, 34) | hsl(120, 60.7%, 33.9%) | hsv(120, 75.5%, 54.5%) | |||||
! lightgreen
style=“background:#90EE90” | | #90EE90 | rgb(144, 238, 144) | hsl(120, 73.4%, 74.9%) | hsv(120, 39.5%, 93.3%) | |||||
! palegreen
style=“background:#98FB98” | | #98FB98 | rgb(152, 251, 152) | hsl(120, 92.5%, 79%) | hsv(120, 39.4%, 98.4%) | |||||
! darkseagreen
style=“background:#8FBC8F” | | #8FBC8F | rgb(143, 188, 143) | hsl(120, 25.1%, 64.9%) | hsv(120, 23.9%, 73.7%) | |||||
! honeydew
style=“background:#F0FFF0” | | #F0FFF0 | rgb(240, 255, 240) | hsl(120, 100%, 97.1%) | hsv(120, 5.9%, 100%) | |||||
! seagreen
style=“background:#2E8B57” | | #2E8B57 | rgb(46, 139, 87) | hsl(146.5, 50.3%, 36.3%) | hsv(146.5, 66.9%, 54.5%) | |||||
! mediumseagreen
style=“background:#3CB371” | | #3CB371 | rgb(60, 179, 113) | hsl(146.7, 49.8%, 46.9%) | hsv(146.7, 66.5%, 70.2%) | |||||
! springgreen
style=“background:#00FF7F” | | #00FF7F | rgb(0, 255, 127) | hsl(149.9, 100%, 50%) | hsv(149.9, 100%, 100%) | |||||
! mintcream
style=“background:#F5FFFA” | | #F5FFFA | rgb(245, 255, 250) | hsl(150, 100%, 98%) | hsv(150, 3.9%, 100%) | |||||
! mediumspringgreen
style=“background:#00FA9A” | | #00FA9A | rgb(0, 250, 154) | hsl(157, 100%, 49%) | hsv(157, 100%, 98%) | |||||
! mediumaquamarine
style=“background:#66CDAA” | | #66CDAA | rgb(102, 205, 170) | hsl(159.6, 50.7%, 60.2%) | hsv(159.6, 50.2%, 80.4%) | |||||
! aquamarine
style=“background:#7FFFD4” | | #7FFFD4 | rgb(127, 255, 212) | hsl(159.8, 100%, 74.9%) | hsv(159.8, 50.2%, 100%) | |||||
! turquoise
style=“background:#40E0D0” | | #40E0D0 | rgb(64, 224, 208) | hsl(174, 72.1%, 56.5%) | hsv(174, 71.4%, 87.8%) | |||||
! lightseagreen
style=“background:#20B2AA” | | #20B2AA | rgb(32, 178, 170) | hsl(176.7, 69.5%, 41.2%) | hsv(176.7, 82%, 69.8%) | |||||
! mediumturquoise
style=“background:#48D1CC” | | #48D1CC | rgb(72, 209, 204) | hsl(177.8, 59.8%, 55.1%) | hsv(177.8, 65.6%, 82%) | |||||
! teal
style=“background:#008080” | | #008080 | rgb(0, 128, 128) | hsl(180, 100%, 25.1%) | hsv(180, 100%, 50.2%) | |||||
! darkcyan
style=“background:#008B8B” | | #008B8B | rgb(0, 139, 139) | hsl(180, 100%, 27.3%) | hsv(180, 100%, 54.5%) | |||||
! aqua, cyan
style=“background:#0FF” | | #0FF | rgb(0, 255, 255) | hsl(180, 100%, 50%) | hsv(180, 100%, 100%) | |||||
! darkslategray, darkslategrey
style=“background:#2F4F4F” | | #2F4F4F | rgb(47, 79, 79) | hsl(180, 25.4%, 24.7%) | hsv(180, 40.5%, 31%) | |||||
! paleturquoise
style=“background:#AFEEEE” | | #AFEEEE | rgb(175, 238, 238) | hsl(180, 64.9%, 81%) | hsv(180, 26.5%, 93.3%) | |||||
! lightcyan
style=“background:#E0FFFF” | | #E0FFFF | rgb(224, 255, 255) | hsl(180, 100%, 93.9%) | hsv(180, 12.2%, 100%) | |||||
! azure
style=“background:#F0FFFF” | | #F0FFFF | rgb(240, 255, 255) | hsl(180, 100%, 97.1%) | hsv(180, 5.9%, 100%) | |||||
! darkturquoise
style=“background:#00CED1” | | #00CED1 | rgb(0, 206, 209) | hsl(180.9, 100%, 41%) | hsv(180.9, 100%, 82%) | |||||
! cadetblue
style=“background:#5F9EA0” | | #5F9EA0 | rgb(95, 158, 160) | hsl(181.8, 25.5%, 50%) | hsv(181.8, 40.6%, 62.7%) | |||||
! powderblue
style=“background:#B0E0E6” | | #B0E0E6 | rgb(176, 224, 230) | hsl(186.7, 51.9%, 79.6%) | hsv(186.7, 23.5%, 90.2%) | |||||
! lightblue
style=“background:#ADD8E6” | | #ADD8E6 | rgb(173, 216, 230) | hsl(194.7, 53.3%, 79%) | hsv(194.7, 24.8%, 90.2%) | |||||
! deepskyblue
style=“background:#00BFFF” | | #00BFFF | rgb(0, 191, 255) | hsl(195.1, 100%, 50%) | hsv(195.1, 100%, 100%) | |||||
! skyblue
style=“background:#87CEEB” | | #87CEEB | rgb(135, 206, 235) | hsl(197.4, 71.4%, 72.5%) | hsv(197.4, 42.6%, 92.2%) | |||||
! lightskyblue
style=“background:#87CEFA” | | #87CEFA | rgb(135, 206, 250) | hsl(203, 92%, 75.5%) | hsv(203, 46%, 98%) | |||||
! steelblue
style=“background:#4682B4” | | #4682B4 | rgb(70, 130, 180) | hsl(207.3, 44%, 49%) | hsv(207.3, 61.1%, 70.6%) | |||||
! aliceblue
style=“background:#F0F8FF” | | #F0F8FF | rgb(240, 248, 255) | hsl(208, 100%, 97.1%) | hsv(208, 5.9%, 100%) | |||||
! dodgerblue
style=“background:#1E90FF” | | #1E90FF | rgb(30, 144, 255) | hsl(209.6, 100%, 55.9%) | hsv(209.6, 88.2%, 100%) | |||||
! slategray, slategrey
style=“background:#708090” | | #708090 | rgb(112, 128, 144) | hsl(210, 12.6%, 50.2%) | hsv(210, 22.2%, 56.5%) | |||||
! lightslategray, lightslategrey
style=“background:#789” | | #789 | rgb(119, 136, 153) | hsl(210, 14.3%, 53.3%) | hsv(210, 22.2%, 60%) | |||||
! lightsteelblue
style=“background:#B0C4DE” | | #B0C4DE | rgb(176, 196, 222) | hsl(213.9, 41.1%, 78%) | hsv(213.9, 20.7%, 87.1%) | |||||
! cornflowerblue
style=“background:#6495ED” | | #6495ED | rgb(100, 149, 237) | hsl(218.5, 79.2%, 66.1%) | hsv(218.5, 57.8%, 92.9%) | |||||
! royalblue
style=“background:#4169E1” | | #4169E1 | rgb(65, 105, 225) | hsl(225, 72.7%, 56.9%) | hsv(225, 71.1%, 88.2%) | |||||
! navy
style=“background:#000080” | | #000080 | rgb(0, 0, 128) | hsl(240, 100%, 25.1%) | hsv(240, 100%, 50.2%) | |||||
! darkblue
style=“background:#00008B” | | #00008B | rgb(0, 0, 139) | hsl(240, 100%, 27.3%) | hsv(240, 100%, 54.5%) | |||||
! mediumblue
style=“background:#0000CD” | | #0000CD | rgb(0, 0, 205) | hsl(240, 100%, 40.2%) | hsv(240, 100%, 80.4%) | |||||
! blue
style=“background:#00F” | | #00F | rgb(0, 0, 255) | hsl(240, 100%, 50%) | hsv(240, 100%, 100%) | |||||
! midnightblue
style=“background:#191970” | | #191970 | rgb(25, 25, 112) | hsl(240, 63.5%, 26.9%) | hsv(240, 77.7%, 43.9%) | |||||
! lavender
style=“background:#E6E6FA” | | #E6E6FA | rgb(230, 230, 250) | hsl(240, 66.7%, 94.1%) | hsv(240, 8%, 98%) | |||||
! ghostwhite
style=“background:#F8F8FF” | | #F8F8FF | rgb(248, 248, 255) | hsl(240, 100%, 98.6%) | hsv(240, 2.7%, 100%) | |||||
! slateblue
style=“background:#6A5ACD” | | #6A5ACD | rgb(106, 90, 205) | hsl(248.3, 53.5%, 57.8%) | hsv(248.3, 56.1%, 80.4%) | |||||
! mediumslateblue
style=“background:#7B68EE” | | #7B68EE | rgb(123, 104, 238) | hsl(248.5, 79.8%, 67.1%) | hsv(248.5, 56.3%, 93.3%) | |||||
! darkslateblue
style=“background:#483D8B” | | #483D8B | rgb(72, 61, 139) | hsl(248.5, 39%, 39.2%) | hsv(248.5, 56.1%, 54.5%) | |||||
! mediumpurple
style=“background:#9370DB” | | #9370DB | rgb(147, 112, 219) | hsl(259.6, 59.8%, 64.9%) | hsv(259.6, 48.9%, 85.9%) | |||||
! blueviolet
style=“background:#8A2BE2” | | #8A2BE2 | rgb(138, 43, 226) | hsl(271.1, 75.9%, 52.7%) | hsv(271.1, 81%, 88.6%) | |||||
! indigo
style=“background:#4B0082” | | #4B0082 | rgb(75, 0, 130) | hsl(274.6, 100%, 25.5%) | hsv(274.6, 100%, 51%) | |||||
! darkorchid
style=“background:#9932CC” | | #9932CC | rgb(153, 50, 204) | hsl(280.1, 60.6%, 49.8%) | hsv(280.1, 75.5%, 80%) | |||||
! darkviolet
style=“background:#9400D3” | | #9400D3 | rgb(148, 0, 211) | hsl(282.1, 100%, 41.4%) | hsv(282.1, 100%, 82.7%) | |||||
! mediumorchid
style=“background:#BA55D3” | | #BA55D3 | rgb(186, 85, 211) | hsl(288.1, 58.9%, 58%) | hsv(288.1, 59.7%, 82.7%) | |||||
! purple
style=“background:#800080” | | #800080 | rgb(128, 0, 128) | hsl(300, 100%, 25.1%) | hsv(300, 100%, 50.2%) | |||||
! darkmagenta
style=“background:#8B008B” | | #8B008B | rgb(139, 0, 139) | hsl(300, 100%, 27.3%) | hsv(300, 100%, 54.5%) | |||||
! fuchsia, magenta
style=“background:#F0F” | | #F0F | rgb(255, 0, 255) | hsl(300, 100%, 50%) | hsv(300, 100%, 100%) | |||||
! violet
style=“background:#EE82EE” | | #EE82EE | rgb(238, 130, 238) | hsl(300, 76.1%, 72.2%) | hsv(300, 45.4%, 93.3%) | |||||
! plum
style=“background:#DDA0DD” | | #DDA0DD | rgb(221, 160, 221) | hsl(300, 47.3%, 74.7%) | hsv(300, 27.6%, 86.7%) | |||||
! thistle
style=“background:#D8BFD8” | | #D8BFD8 | rgb(216, 191, 216) | hsl(300, 24.3%, 79.8%) | hsv(300, 11.6%, 84.7%) | |||||
! orchid
style=“background:#DA70D6” | | #DA70D6 | rgb(218, 112, 214) | hsl(302.3, 58.9%, 64.7%) | hsv(302.3, 48.6%, 85.5%) | |||||
! mediumvioletred
style=“background:#C71585” | | #C71585 | rgb(199, 21, 133) | hsl(322.2, 80.9%, 43.1%) | hsv(322.2, 89.4%, 78%) | |||||
! deeppink
style=“background:#FF1493” | | #FF1493 | rgb(255, 20, 147) | hsl(327.6, 100%, 53.9%) | hsv(327.6, 92.2%, 100%) | |||||
! hotpink
style=“background:#FF69B4” | | #FF69B4 | rgb(255, 105, 180) | hsl(330, 100%, 70.6%) | hsv(330, 58.8%, 100%) | |||||
! lavenderblush
style=“background:#FFF0F5” | | #FFF0F5 | rgb(255, 240, 245) | hsl(340, 100%, 97.1%) | hsv(340, 5.9%, 100%) | |||||
! palevioletred
style=“background:#DB7093” | | #DB7093 | rgb(219, 112, 147) | hsl(340.4, 59.8%, 64.9%) | hsv(340.4, 48.9%, 85.9%) | |||||
! crimson
style=“background:#DC143C” | | #DC143C | rgb(220, 20, 60) | hsl(348, 83.3%, 47.1%) | hsv(348, 90.9%, 86.3%) | |||||
! pink
style=“background:#FFC0CB” | | #FFC0CB | rgb(255, 192, 203) | hsl(349.5, 100%, 87.6%) | hsv(349.5, 24.7%, 100%) | |||||
! lightpink
style=“background:#FFB6C1” | | #FFB6C1 | rgb(255, 182, 193) | hsl(351, 100%, 85.7%) | hsv(351, 28.6%, 100%) | |||||
</code>
Voici le résultat (les couleurs sont inversées volontairement car mon écran afficahit les couleurs complémentaire. Il est facile en commentant l'inversion dans le code python ci-dessus d'obtenir le tableau des couleurs normales):
#define BLACK 0xFFFF #define DIMGRAY 0x94B2 #define GRAY 0x7BEF #define DARKGRAY 0x52AA #define SILVER 0x39E7 #define LIGHTGRAY 0x2945 #define GAINSBORO 0x2104 #define WHITESMOKE 0x0841 #define WHITE 0x0000 #define MAROON 0x7FFF #define DARKRED 0x77FF #define RED 0x07FF #define FIREBRICK 0x4EDA #define BROWN 0x5699 #define INDIANRED 0x3513 #define LIGHTCORAL 0x0BEF #define ROSYBROWN 0x436D #define SNOW 0x0020 #define MISTYROSE 0x00C3 #define SALMON 0x03F1 #define TOMATO 0x04D6 #define DARKSALMON 0x1330 #define CORAL 0x03F5 #define ORANGERED 0x05BF #define LIGHTSALMON 0x02F0 #define SIENNA 0x5D59 #define SEASHELL 0x0042 #define SADDLEBROWN 0x75BC #define CHOCOLATE 0x2CBB #define SANDYBROWN 0x0AD3 #define PEACHPUFF 0x0128 #define PERU 0x33D7 #define LINEN 0x0063 #define BISQUE 0x00C7 #define DARKORANGE 0x039F #define BURLYWOOD 0x222E #define TAN 0x2A4D #define ANTIQUEWHITE 0x0084 #define NAVAJOWHITE 0x0109 #define BLANCHEDALMOND 0x0086 #define PAPAYAWHIP 0x0065 #define MOCCASIN 0x00C8 #define ORANGE 0x02DF #define WHEAT 0x0909 #define OLDLACE 0x0043 #define FLORALWHITE 0x0021 #define DARKGOLDENROD 0x43BD #define GOLDENROD 0x22DB #define CORNSILK 0x0024 #define GOLD 0x013F #define KHAKI 0x08CD #define LEMONCHIFFON 0x0026 #define PALEGOLDENROD 0x10AA #define DARKKHAKI 0x4231 #define OLIVE 0x7BFF #define YELLOW 0x001F #define LIGHTGOLDENRODYELLOW 0x0025 #define LIGHTYELLOW 0x0003 #define BEIGE 0x0844 #define IVORY 0x0001 #define OLIVEDRAB 0x8B7A #define YELLOWGREEN 0x6198 #define DARKOLIVEGREEN 0xA499 #define GREENYELLOW 0x4819 #define CHARTREUSE 0x781F #define LAWNGREEN 0x781F #define DARKGREEN 0xFCDF #define GREEN 0xFBFF #define LIME 0xF81F #define LIMEGREEN 0xC198 #define FORESTGREEN 0xD39A #define LIGHTGREEN 0x688D #define PALEGREEN 0x600C #define DARKSEAGREEN 0x6A0D #define HONEYDEW 0x0801 #define SEAGREEN 0xCB94 #define MEDIUMSEAGREEN 0xBA51 #define SPRINGGREEN 0xF80F #define MINTCREAM 0x0800 #define MEDIUMSPRINGGREEN 0xF82C #define MEDIUMAQUAMARINE 0x918A #define AQUAMARINE 0x7805 #define TURQUOISE 0xB8E5 #define LIGHTSEAGREEN 0xDA6A #define MEDIUMTURQUOISE 0xB166 #define TEAL 0xFBEF #define DARKCYAN 0xFB8E #define AQUA 0xF800 #define DARKSLATEGRAY 0xCD75 #define PALETURQUOISE 0x4882 #define LIGHTCYAN 0x1800 #define AZURE 0x0800 #define DARKTURQUOISE 0xF985 #define CADETBLUE 0x9AEB #define POWDERBLUE 0x48E3 #define LIGHTBLUE 0x4923 #define DEEPSKYBLUE 0xF9E0 #define SKYBLUE 0x7182 #define LIGHTSKYBLUE 0x7180 #define STEELBLUE 0xB3C9 #define ALICEBLUE 0x0820 #define DODGERBLUE 0xDB60 #define SLATEGRAY 0x8BED #define LIGHTSLATEGRAY 0x83AC #define LIGHTSTEELBLUE 0x49C4 #define CORNFLOWERBLUE 0x9342 #define ROYALBLUE 0xBCA3 #define NAVY 0xFFEF #define DARKBLUE 0xFFEE #define MEDIUMBLUE 0xFFE6 #define BLUE 0xFFE0 #define MIDNIGHTBLUE 0xDF11 #define LAVENDER 0x18C0 #define GHOSTWHITE 0x0020 #define SLATEBLUE 0x9506 #define MEDIUMSLATEBLUE 0x84A2 #define DARKSLATEBLUE 0xB5EE #define MEDIUMPURPLE 0x6C64 #define BLUEVIOLET 0x7683 #define INDIGO 0xAFEF #define DARKORCHID 0x6646 #define DARKVIOLET 0x6FE5 #define MEDIUMORCHID 0x4545 #define PURPLE 0x7FEF #define DARKMAGENTA 0x77EE #define FUCHSIA 0x07E0 #define VIOLET 0x13C2 #define PLUM 0x22E4 #define THISTLE 0x21E4 #define ORCHID 0x2464 #define MEDIUMVIOLETRED 0x372E #define DEEPPINK 0x074D #define HOTPINK 0x04A9 #define LAVENDERBLUSH 0x0061 #define PALEVIOLETRED 0x246D #define CRIMSON 0x2757 #define PINK 0x01E6 #define LIGHTPINK 0x0247