#include /* * author(s) and license */ #include #include #include #include #include "rgb_color.hh" static struct rgb_and_name{unsigned char r, g, b; const char *cname;} rgb_names[] = { {0xf0,0xf8,0xff,"alice blue"}, {0xf0,0xf8,0xff,"aliceblue"}, {0xfa,0xeb,0xd7,"antique white"}, {0xfa,0xeb,0xd7,"antiquewhite"}, {0xff,0xef,0xdb,"antiquewhite1"}, {0xee,0xdf,0xcc,"antiquewhite2"}, {0xcd,0xc0,0xb0,"antiquewhite3"}, {0x8b,0x83,0x78,"antiquewhite4"}, {0x7f,0xff,0xd4,"aquamarine"}, {0x7f,0xff,0xd4,"aquamarine1"}, {0x76,0xee,0xc6,"aquamarine2"}, {0x66,0xcd,0xaa,"aquamarine3"}, {0x45,0x8b,0x74,"aquamarine4"}, {0xf0,0xff,0xff,"azure"}, {0xf0,0xff,0xff,"azure1"}, {0xe0,0xee,0xee,"azure2"}, {0xc1,0xcd,0xcd,"azure3"}, {0x83,0x8b,0x8b,"azure4"}, {0xf5,0xf5,0xdc,"beige"}, {0xff,0xe4,0xc4,"bisque"}, {0xff,0xe4,0xc4,"bisque1"}, {0xee,0xd5,0xb7,"bisque2"}, {0xcd,0xb7,0x9e,"bisque3"}, {0x8b,0x7d,0x6b,"bisque4"}, {0x00,0x00,0x00,"black"}, {0xff,0xeb,0xcd,"blanched almond"}, {0xff,0xeb,0xcd,"blanchedalmond"}, {0x00,0x00,0xff,"blue"}, {0x8a,0x2b,0xe2,"blue violet"}, {0x00,0x00,0xff,"blue1"}, {0x00,0x00,0xee,"blue2"}, {0x00,0x00,0xcd,"blue3"}, {0x00,0x00,0x8b,"blue4"}, {0x8a,0x2b,0xe2,"blueviolet"}, {0xa5,0x2a,0x2a,"brown"}, {0xff,0x40,0x40,"brown1"}, {0xee,0x3b,0x3b,"brown2"}, {0xcd,0x33,0x33,"brown3"}, {0x8b,0x23,0x23,"brown4"}, {0xde,0xb8,0x87,"burlywood"}, {0xff,0xd3,0x9b,"burlywood1"}, {0xee,0xc5,0x91,"burlywood2"}, {0xcd,0xaa,0x7d,"burlywood3"}, {0x8b,0x73,0x55,"burlywood4"}, {0x5f,0x9e,0xa0,"cadet blue"}, {0x5f,0x9e,0xa0,"cadetblue"}, {0x98,0xf5,0xff,"cadetblue1"}, {0x8e,0xe5,0xee,"cadetblue2"}, {0x7a,0xc5,0xcd,"cadetblue3"}, {0x53,0x86,0x8b,"cadetblue4"}, {0x7f,0xff,0x00,"chartreuse"}, {0x7f,0xff,0x00,"chartreuse1"}, {0x76,0xee,0x00,"chartreuse2"}, {0x66,0xcd,0x00,"chartreuse3"}, {0x45,0x8b,0x00,"chartreuse4"}, {0xd2,0x69,0x1e,"chocolate"}, {0xff,0x7f,0x24,"chocolate1"}, {0xee,0x76,0x21,"chocolate2"}, {0xcd,0x66,0x1d,"chocolate3"}, {0x8b,0x45,0x13,"chocolate4"}, {0xff,0x7f,0x50,"coral"}, {0xff,0x72,0x56,"coral1"}, {0xee,0x6a,0x50,"coral2"}, {0xcd,0x5b,0x45,"coral3"}, {0x8b,0x3e,0x2f,"coral4"}, {0x64,0x95,0xed,"cornflower blue"}, {0x64,0x95,0xed,"cornflowerblue"}, {0xff,0xf8,0xdc,"cornsilk"}, {0xff,0xf8,0xdc,"cornsilk1"}, {0xee,0xe8,0xcd,"cornsilk2"}, {0xcd,0xc8,0xb1,"cornsilk3"}, {0x8b,0x88,0x78,"cornsilk4"}, {0x00,0xff,0xff,"cyan"}, {0x00,0xff,0xff,"cyan1"}, {0x00,0xee,0xee,"cyan2"}, {0x00,0xcd,0xcd,"cyan3"}, {0x00,0x8b,0x8b,"cyan4"}, {0x00,0x00,0x8b,"dark blue"}, {0x00,0x8b,0x8b,"dark cyan"}, {0xb8,0x86,0x0b,"dark goldenrod"}, {0xa9,0xa9,0xa9,"dark gray"}, {0x00,0x64,0x00,"dark green"}, {0xa9,0xa9,0xa9,"dark grey"}, {0xbd,0xb7,0x6b,"dark khaki"}, {0x8b,0x00,0x8b,"dark magenta"}, {0x55,0x6b,0x2f,"dark olive green"}, {0xff,0x8c,0x00,"dark orange"}, {0x99,0x32,0xcc,"dark orchid"}, {0x8b,0x00,0x00,"dark red"}, {0xe9,0x96,0x7a,"dark salmon"}, {0x8f,0xbc,0x8f,"dark sea green"}, {0x48,0x3d,0x8b,"dark slate blue"}, {0x2f,0x4f,0x4f,"dark slate gray"}, {0x2f,0x4f,0x4f,"dark slate grey"}, {0x00,0xce,0xd1,"dark turquoise"}, {0x94,0x00,0xd3,"dark violet"}, {0x00,0x00,0x8b,"darkblue"}, {0x00,0x8b,0x8b,"darkcyan"}, {0xb8,0x86,0x0b,"darkgoldenrod"}, {0xff,0xb9,0x0f,"darkgoldenrod1"}, {0xee,0xad,0x0e,"darkgoldenrod2"}, {0xcd,0x95,0x0c,"darkgoldenrod3"}, {0x8b,0x65,0x08,"darkgoldenrod4"}, {0xa9,0xa9,0xa9,"darkgray"}, {0x00,0x64,0x00,"darkgreen"}, {0xa9,0xa9,0xa9,"darkgrey"}, {0xbd,0xb7,0x6b,"darkkhaki"}, {0x8b,0x00,0x8b,"darkmagenta"}, {0x55,0x6b,0x2f,"darkolivegreen"}, {0xca,0xff,0x70,"darkolivegreen1"}, {0xbc,0xee,0x68,"darkolivegreen2"}, {0xa2,0xcd,0x5a,"darkolivegreen3"}, {0x6e,0x8b,0x3d,"darkolivegreen4"}, {0xff,0x8c,0x00,"darkorange"}, {0xff,0x7f,0x00,"darkorange1"}, {0xee,0x76,0x00,"darkorange2"}, {0xcd,0x66,0x00,"darkorange3"}, {0x8b,0x45,0x00,"darkorange4"}, {0x99,0x32,0xcc,"darkorchid"}, {0xbf,0x3e,0xff,"darkorchid1"}, {0xb2,0x3a,0xee,"darkorchid2"}, {0x9a,0x32,0xcd,"darkorchid3"}, {0x68,0x22,0x8b,"darkorchid4"}, {0x8b,0x00,0x00,"darkred"}, {0xe9,0x96,0x7a,"darksalmon"}, {0x8f,0xbc,0x8f,"darkseagreen"}, {0xc1,0xff,0xc1,"darkseagreen1"}, {0xb4,0xee,0xb4,"darkseagreen2"}, {0x9b,0xcd,0x9b,"darkseagreen3"}, {0x69,0x8b,0x69,"darkseagreen4"}, {0x48,0x3d,0x8b,"darkslateblue"}, {0x2f,0x4f,0x4f,"darkslategray"}, {0x97,0xff,0xff,"darkslategray1"}, {0x8d,0xee,0xee,"darkslategray2"}, {0x79,0xcd,0xcd,"darkslategray3"}, {0x52,0x8b,0x8b,"darkslategray4"}, {0x2f,0x4f,0x4f,"darkslategrey"}, {0x00,0xce,0xd1,"darkturquoise"}, {0x94,0x00,0xd3,"darkviolet"}, {0xff,0x14,0x93,"deep pink"}, {0x00,0xbf,0xff,"deep sky blue"}, {0xff,0x14,0x93,"deeppink"}, {0xff,0x14,0x93,"deeppink1"}, {0xee,0x12,0x89,"deeppink2"}, {0xcd,0x10,0x76,"deeppink3"}, {0x8b,0x0a,0x50,"deeppink4"}, {0x00,0xbf,0xff,"deepskyblue"}, {0x00,0xbf,0xff,"deepskyblue1"}, {0x00,0xb2,0xee,"deepskyblue2"}, {0x00,0x9a,0xcd,"deepskyblue3"}, {0x00,0x68,0x8b,"deepskyblue4"}, {0x69,0x69,0x69,"dim gray"}, {0x69,0x69,0x69,"dim grey"}, {0x69,0x69,0x69,"dimgray"}, {0x69,0x69,0x69,"dimgrey"}, {0x1e,0x90,0xff,"dodger blue"}, {0x1e,0x90,0xff,"dodgerblue"}, {0x1e,0x90,0xff,"dodgerblue1"}, {0x1c,0x86,0xee,"dodgerblue2"}, {0x18,0x74,0xcd,"dodgerblue3"}, {0x10,0x4e,0x8b,"dodgerblue4"}, {0xb2,0x22,0x22,"firebrick"}, {0xff,0x30,0x30,"firebrick1"}, {0xee,0x2c,0x2c,"firebrick2"}, {0xcd,0x26,0x26,"firebrick3"}, {0x8b,0x1a,0x1a,"firebrick4"}, {0xff,0xfa,0xf0,"floral white"}, {0xff,0xfa,0xf0,"floralwhite"}, {0x22,0x8b,0x22,"forest green"}, {0x22,0x8b,0x22,"forestgreen"}, {0xdc,0xdc,0xdc,"gainsboro"}, {0xf8,0xf8,0xff,"ghost white"}, {0xf8,0xf8,0xff,"ghostwhite"}, {0xff,0xd7,0x00,"gold"}, {0xff,0xd7,0x00,"gold1"}, {0xee,0xc9,0x00,"gold2"}, {0xcd,0xad,0x00,"gold3"}, {0x8b,0x75,0x00,"gold4"}, {0xda,0xa5,0x20,"goldenrod"}, {0xff,0xc1,0x25,"goldenrod1"}, {0xee,0xb4,0x22,"goldenrod2"}, {0xcd,0x9b,0x1d,"goldenrod3"}, {0x8b,0x69,0x14,"goldenrod4"}, {0xbe,0xbe,0xbe,"gray"}, {0x00,0x00,0x00,"gray0"}, {0x03,0x03,0x03,"gray1"}, {0x1a,0x1a,0x1a,"gray10"}, {0xff,0xff,0xff,"gray100"}, {0x1c,0x1c,0x1c,"gray11"}, {0x1f,0x1f,0x1f,"gray12"}, {0x21,0x21,0x21,"gray13"}, {0x24,0x24,0x24,"gray14"}, {0x26,0x26,0x26,"gray15"}, {0x29,0x29,0x29,"gray16"}, {0x2b,0x2b,0x2b,"gray17"}, {0x2e,0x2e,0x2e,"gray18"}, {0x30,0x30,0x30,"gray19"}, {0x05,0x05,0x05,"gray2"}, {0x33,0x33,0x33,"gray20"}, {0x36,0x36,0x36,"gray21"}, {0x38,0x38,0x38,"gray22"}, {0x3b,0x3b,0x3b,"gray23"}, {0x3d,0x3d,0x3d,"gray24"}, {0x40,0x40,0x40,"gray25"}, {0x42,0x42,0x42,"gray26"}, {0x45,0x45,0x45,"gray27"}, {0x47,0x47,0x47,"gray28"}, {0x4a,0x4a,0x4a,"gray29"}, {0x08,0x08,0x08,"gray3"}, {0x4d,0x4d,0x4d,"gray30"}, {0x4f,0x4f,0x4f,"gray31"}, {0x52,0x52,0x52,"gray32"}, {0x54,0x54,0x54,"gray33"}, {0x57,0x57,0x57,"gray34"}, {0x59,0x59,0x59,"gray35"}, {0x5c,0x5c,0x5c,"gray36"}, {0x5e,0x5e,0x5e,"gray37"}, {0x61,0x61,0x61,"gray38"}, {0x63,0x63,0x63,"gray39"}, {0x0a,0x0a,0x0a,"gray4"}, {0x66,0x66,0x66,"gray40"}, {0x69,0x69,0x69,"gray41"}, {0x6b,0x6b,0x6b,"gray42"}, {0x6e,0x6e,0x6e,"gray43"}, {0x70,0x70,0x70,"gray44"}, {0x73,0x73,0x73,"gray45"}, {0x75,0x75,0x75,"gray46"}, {0x78,0x78,0x78,"gray47"}, {0x7a,0x7a,0x7a,"gray48"}, {0x7d,0x7d,0x7d,"gray49"}, {0x0d,0x0d,0x0d,"gray5"}, {0x7f,0x7f,0x7f,"gray50"}, {0x82,0x82,0x82,"gray51"}, {0x85,0x85,0x85,"gray52"}, {0x87,0x87,0x87,"gray53"}, {0x8a,0x8a,0x8a,"gray54"}, {0x8c,0x8c,0x8c,"gray55"}, {0x8f,0x8f,0x8f,"gray56"}, {0x91,0x91,0x91,"gray57"}, {0x94,0x94,0x94,"gray58"}, {0x96,0x96,0x96,"gray59"}, {0x0f,0x0f,0x0f,"gray6"}, {0x99,0x99,0x99,"gray60"}, {0x9c,0x9c,0x9c,"gray61"}, {0x9e,0x9e,0x9e,"gray62"}, {0xa1,0xa1,0xa1,"gray63"}, {0xa3,0xa3,0xa3,"gray64"}, {0xa6,0xa6,0xa6,"gray65"}, {0xa8,0xa8,0xa8,"gray66"}, {0xab,0xab,0xab,"gray67"}, {0xad,0xad,0xad,"gray68"}, {0xb0,0xb0,0xb0,"gray69"}, {0x12,0x12,0x12,"gray7"}, {0xb3,0xb3,0xb3,"gray70"}, {0xb5,0xb5,0xb5,"gray71"}, {0xb8,0xb8,0xb8,"gray72"}, {0xba,0xba,0xba,"gray73"}, {0xbd,0xbd,0xbd,"gray74"}, {0xbf,0xbf,0xbf,"gray75"}, {0xc2,0xc2,0xc2,"gray76"}, {0xc4,0xc4,0xc4,"gray77"}, {0xc7,0xc7,0xc7,"gray78"}, {0xc9,0xc9,0xc9,"gray79"}, {0x14,0x14,0x14,"gray8"}, {0xcc,0xcc,0xcc,"gray80"}, {0xcf,0xcf,0xcf,"gray81"}, {0xd1,0xd1,0xd1,"gray82"}, {0xd4,0xd4,0xd4,"gray83"}, {0xd6,0xd6,0xd6,"gray84"}, {0xd9,0xd9,0xd9,"gray85"}, {0xdb,0xdb,0xdb,"gray86"}, {0xde,0xde,0xde,"gray87"}, {0xe0,0xe0,0xe0,"gray88"}, {0xe3,0xe3,0xe3,"gray89"}, {0x17,0x17,0x17,"gray9"}, {0xe5,0xe5,0xe5,"gray90"}, {0xe8,0xe8,0xe8,"gray91"}, {0xeb,0xeb,0xeb,"gray92"}, {0xed,0xed,0xed,"gray93"}, {0xf0,0xf0,0xf0,"gray94"}, {0xf2,0xf2,0xf2,"gray95"}, {0xf5,0xf5,0xf5,"gray96"}, {0xf7,0xf7,0xf7,"gray97"}, {0xfa,0xfa,0xfa,"gray98"}, {0xfc,0xfc,0xfc,"gray99"}, {0x00,0xff,0x00,"green"}, {0xad,0xff,0x2f,"green yellow"}, {0x00,0xff,0x00,"green1"}, {0x00,0xee,0x00,"green2"}, {0x00,0xcd,0x00,"green3"}, {0x00,0x8b,0x00,"green4"}, {0xad,0xff,0x2f,"greenyellow"}, {0xbe,0xbe,0xbe,"grey"}, {0x00,0x00,0x00,"grey0"}, {0x03,0x03,0x03,"grey1"}, {0x1a,0x1a,0x1a,"grey10"}, {0xff,0xff,0xff,"grey100"}, {0x1c,0x1c,0x1c,"grey11"}, {0x1f,0x1f,0x1f,"grey12"}, {0x21,0x21,0x21,"grey13"}, {0x24,0x24,0x24,"grey14"}, {0x26,0x26,0x26,"grey15"}, {0x29,0x29,0x29,"grey16"}, {0x2b,0x2b,0x2b,"grey17"}, {0x2e,0x2e,0x2e,"grey18"}, {0x30,0x30,0x30,"grey19"}, {0x05,0x05,0x05,"grey2"}, {0x33,0x33,0x33,"grey20"}, {0x36,0x36,0x36,"grey21"}, {0x38,0x38,0x38,"grey22"}, {0x3b,0x3b,0x3b,"grey23"}, {0x3d,0x3d,0x3d,"grey24"}, {0x40,0x40,0x40,"grey25"}, {0x42,0x42,0x42,"grey26"}, {0x45,0x45,0x45,"grey27"}, {0x47,0x47,0x47,"grey28"}, {0x4a,0x4a,0x4a,"grey29"}, {0x08,0x08,0x08,"grey3"}, {0x4d,0x4d,0x4d,"grey30"}, {0x4f,0x4f,0x4f,"grey31"}, {0x52,0x52,0x52,"grey32"}, {0x54,0x54,0x54,"grey33"}, {0x57,0x57,0x57,"grey34"}, {0x59,0x59,0x59,"grey35"}, {0x5c,0x5c,0x5c,"grey36"}, {0x5e,0x5e,0x5e,"grey37"}, {0x61,0x61,0x61,"grey38"}, {0x63,0x63,0x63,"grey39"}, {0x0a,0x0a,0x0a,"grey4"}, {0x66,0x66,0x66,"grey40"}, {0x69,0x69,0x69,"grey41"}, {0x6b,0x6b,0x6b,"grey42"}, {0x6e,0x6e,0x6e,"grey43"}, {0x70,0x70,0x70,"grey44"}, {0x73,0x73,0x73,"grey45"}, {0x75,0x75,0x75,"grey46"}, {0x78,0x78,0x78,"grey47"}, {0x7a,0x7a,0x7a,"grey48"}, {0x7d,0x7d,0x7d,"grey49"}, {0x0d,0x0d,0x0d,"grey5"}, {0x7f,0x7f,0x7f,"grey50"}, {0x82,0x82,0x82,"grey51"}, {0x85,0x85,0x85,"grey52"}, {0x87,0x87,0x87,"grey53"}, {0x8a,0x8a,0x8a,"grey54"}, {0x8c,0x8c,0x8c,"grey55"}, {0x8f,0x8f,0x8f,"grey56"}, {0x91,0x91,0x91,"grey57"}, {0x94,0x94,0x94,"grey58"}, {0x96,0x96,0x96,"grey59"}, {0x0f,0x0f,0x0f,"grey6"}, {0x99,0x99,0x99,"grey60"}, {0x9c,0x9c,0x9c,"grey61"}, {0x9e,0x9e,0x9e,"grey62"}, {0xa1,0xa1,0xa1,"grey63"}, {0xa3,0xa3,0xa3,"grey64"}, {0xa6,0xa6,0xa6,"grey65"}, {0xa8,0xa8,0xa8,"grey66"}, {0xab,0xab,0xab,"grey67"}, {0xad,0xad,0xad,"grey68"}, {0xb0,0xb0,0xb0,"grey69"}, {0x12,0x12,0x12,"grey7"}, {0xb3,0xb3,0xb3,"grey70"}, {0xb5,0xb5,0xb5,"grey71"}, {0xb8,0xb8,0xb8,"grey72"}, {0xba,0xba,0xba,"grey73"}, {0xbd,0xbd,0xbd,"grey74"}, {0xbf,0xbf,0xbf,"grey75"}, {0xc2,0xc2,0xc2,"grey76"}, {0xc4,0xc4,0xc4,"grey77"}, {0xc7,0xc7,0xc7,"grey78"}, {0xc9,0xc9,0xc9,"grey79"}, {0x14,0x14,0x14,"grey8"}, {0xcc,0xcc,0xcc,"grey80"}, {0xcf,0xcf,0xcf,"grey81"}, {0xd1,0xd1,0xd1,"grey82"}, {0xd4,0xd4,0xd4,"grey83"}, {0xd6,0xd6,0xd6,"grey84"}, {0xd9,0xd9,0xd9,"grey85"}, {0xdb,0xdb,0xdb,"grey86"}, {0xde,0xde,0xde,"grey87"}, {0xe0,0xe0,0xe0,"grey88"}, {0xe3,0xe3,0xe3,"grey89"}, {0x17,0x17,0x17,"grey9"}, {0xe5,0xe5,0xe5,"grey90"}, {0xe8,0xe8,0xe8,"grey91"}, {0xeb,0xeb,0xeb,"grey92"}, {0xed,0xed,0xed,"grey93"}, {0xf0,0xf0,0xf0,"grey94"}, {0xf2,0xf2,0xf2,"grey95"}, {0xf5,0xf5,0xf5,"grey96"}, {0xf7,0xf7,0xf7,"grey97"}, {0xfa,0xfa,0xfa,"grey98"}, {0xfc,0xfc,0xfc,"grey99"}, {0xf0,0xff,0xf0,"honeydew"}, {0xf0,0xff,0xf0,"honeydew1"}, {0xe0,0xee,0xe0,"honeydew2"}, {0xc1,0xcd,0xc1,"honeydew3"}, {0x83,0x8b,0x83,"honeydew4"}, {0xff,0x69,0xb4,"hot pink"}, {0xff,0x69,0xb4,"hotpink"}, {0xff,0x6e,0xb4,"hotpink1"}, {0xee,0x6a,0xa7,"hotpink2"}, {0xcd,0x60,0x90,"hotpink3"}, {0x8b,0x3a,0x62,"hotpink4"}, {0xcd,0x5c,0x5c,"indian red"}, {0xcd,0x5c,0x5c,"indianred"}, {0xff,0x6a,0x6a,"indianred1"}, {0xee,0x63,0x63,"indianred2"}, {0xcd,0x55,0x55,"indianred3"}, {0x8b,0x3a,0x3a,"indianred4"}, {0xff,0xff,0xf0,"ivory"}, {0xff,0xff,0xf0,"ivory1"}, {0xee,0xee,0xe0,"ivory2"}, {0xcd,0xcd,0xc1,"ivory3"}, {0x8b,0x8b,0x83,"ivory4"}, {0xf0,0xe6,0x8c,"khaki"}, {0xff,0xf6,0x8f,"khaki1"}, {0xee,0xe6,0x85,"khaki2"}, {0xcd,0xc6,0x73,"khaki3"}, {0x8b,0x86,0x4e,"khaki4"}, {0xe6,0xe6,0xfa,"lavender"}, {0xff,0xf0,0xf5,"lavender blush"}, {0xff,0xf0,0xf5,"lavenderblush"}, {0xff,0xf0,0xf5,"lavenderblush1"}, {0xee,0xe0,0xe5,"lavenderblush2"}, {0xcd,0xc1,0xc5,"lavenderblush3"}, {0x8b,0x83,0x86,"lavenderblush4"}, {0x7c,0xfc,0x00,"lawn green"}, {0x7c,0xfc,0x00,"lawngreen"}, {0xff,0xfa,0xcd,"lemon chiffon"}, {0xff,0xfa,0xcd,"lemonchiffon"}, {0xff,0xfa,0xcd,"lemonchiffon1"}, {0xee,0xe9,0xbf,"lemonchiffon2"}, {0xcd,0xc9,0xa5,"lemonchiffon3"}, {0x8b,0x89,0x70,"lemonchiffon4"}, {0xad,0xd8,0xe6,"light blue"}, {0xf0,0x80,0x80,"light coral"}, {0xe0,0xff,0xff,"light cyan"}, {0xee,0xdd,0x82,"light goldenrod"}, {0xfa,0xfa,0xd2,"light goldenrod yellow"}, {0xd3,0xd3,0xd3,"light gray"}, {0x90,0xee,0x90,"light green"}, {0xd3,0xd3,0xd3,"light grey"}, {0xff,0xb6,0xc1,"light pink"}, {0xff,0xa0,0x7a,"light salmon"}, {0x20,0xb2,0xaa,"light sea green"}, {0x87,0xce,0xfa,"light sky blue"}, {0x84,0x70,0xff,"light slate blue"}, {0x77,0x88,0x99,"light slate gray"}, {0x77,0x88,0x99,"light slate grey"}, {0xb0,0xc4,0xde,"light steel blue"}, {0xff,0xff,0xe0,"light yellow"}, {0xad,0xd8,0xe6,"lightblue"}, {0xbf,0xef,0xff,"lightblue1"}, {0xb2,0xdf,0xee,"lightblue2"}, {0x9a,0xc0,0xcd,"lightblue3"}, {0x68,0x83,0x8b,"lightblue4"}, {0xf0,0x80,0x80,"lightcoral"}, {0xe0,0xff,0xff,"lightcyan"}, {0xe0,0xff,0xff,"lightcyan1"}, {0xd1,0xee,0xee,"lightcyan2"}, {0xb4,0xcd,0xcd,"lightcyan3"}, {0x7a,0x8b,0x8b,"lightcyan4"}, {0xee,0xdd,0x82,"lightgoldenrod"}, {0xff,0xec,0x8b,"lightgoldenrod1"}, {0xee,0xdc,0x82,"lightgoldenrod2"}, {0xcd,0xbe,0x70,"lightgoldenrod3"}, {0x8b,0x81,0x4c,"lightgoldenrod4"}, {0xfa,0xfa,0xd2,"lightgoldenrodyellow"}, {0xd3,0xd3,0xd3,"lightgray"}, {0x90,0xee,0x90,"lightgreen"}, {0xd3,0xd3,0xd3,"lightgrey"}, {0xff,0xb6,0xc1,"lightpink"}, {0xff,0xae,0xb9,"lightpink1"}, {0xee,0xa2,0xad,"lightpink2"}, {0xcd,0x8c,0x95,"lightpink3"}, {0x8b,0x5f,0x65,"lightpink4"}, {0xff,0xa0,0x7a,"lightsalmon"}, {0xff,0xa0,0x7a,"lightsalmon1"}, {0xee,0x95,0x72,"lightsalmon2"}, {0xcd,0x81,0x62,"lightsalmon3"}, {0x8b,0x57,0x42,"lightsalmon4"}, {0x20,0xb2,0xaa,"lightseagreen"}, {0x87,0xce,0xfa,"lightskyblue"}, {0xb0,0xe2,0xff,"lightskyblue1"}, {0xa4,0xd3,0xee,"lightskyblue2"}, {0x8d,0xb6,0xcd,"lightskyblue3"}, {0x60,0x7b,0x8b,"lightskyblue4"}, {0x84,0x70,0xff,"lightslateblue"}, {0x77,0x88,0x99,"lightslategray"}, {0x77,0x88,0x99,"lightslategrey"}, {0xb0,0xc4,0xde,"lightsteelblue"}, {0xca,0xe1,0xff,"lightsteelblue1"}, {0xbc,0xd2,0xee,"lightsteelblue2"}, {0xa2,0xb5,0xcd,"lightsteelblue3"}, {0x6e,0x7b,0x8b,"lightsteelblue4"}, {0xff,0xff,0xe0,"lightyellow"}, {0xff,0xff,0xe0,"lightyellow1"}, {0xee,0xee,0xd1,"lightyellow2"}, {0xcd,0xcd,0xb4,"lightyellow3"}, {0x8b,0x8b,0x7a,"lightyellow4"}, {0x32,0xcd,0x32,"lime green"}, {0x32,0xcd,0x32,"limegreen"}, {0xfa,0xf0,0xe6,"linen"}, {0xff,0x00,0xff,"magenta"}, {0xff,0x00,0xff,"magenta1"}, {0xee,0x00,0xee,"magenta2"}, {0xcd,0x00,0xcd,"magenta3"}, {0x8b,0x00,0x8b,"magenta4"}, {0xb0,0x30,0x60,"maroon"}, {0xff,0x34,0xb3,"maroon1"}, {0xee,0x30,0xa7,"maroon2"}, {0xcd,0x29,0x90,"maroon3"}, {0x8b,0x1c,0x62,"maroon4"}, {0x66,0xcd,0xaa,"medium aquamarine"}, {0x00,0x00,0xcd,"medium blue"}, {0xba,0x55,0xd3,"medium orchid"}, {0x93,0x70,0xdb,"medium purple"}, {0x3c,0xb3,0x71,"medium sea green"}, {0x7b,0x68,0xee,"medium slate blue"}, {0x00,0xfa,0x9a,"medium spring green"}, {0x48,0xd1,0xcc,"medium turquoise"}, {0xc7,0x15,0x85,"medium violet red"}, {0x66,0xcd,0xaa,"mediumaquamarine"}, {0x00,0x00,0xcd,"mediumblue"}, {0xba,0x55,0xd3,"mediumorchid"}, {0xe0,0x66,0xff,"mediumorchid1"}, {0xd1,0x5f,0xee,"mediumorchid2"}, {0xb4,0x52,0xcd,"mediumorchid3"}, {0x7a,0x37,0x8b,"mediumorchid4"}, {0x93,0x70,0xdb,"mediumpurple"}, {0xab,0x82,0xff,"mediumpurple1"}, {0x9f,0x79,0xee,"mediumpurple2"}, {0x89,0x68,0xcd,"mediumpurple3"}, {0x5d,0x47,0x8b,"mediumpurple4"}, {0x3c,0xb3,0x71,"mediumseagreen"}, {0x7b,0x68,0xee,"mediumslateblue"}, {0x00,0xfa,0x9a,"mediumspringgreen"}, {0x48,0xd1,0xcc,"mediumturquoise"}, {0xc7,0x15,0x85,"mediumvioletred"}, {0x19,0x19,0x70,"midnight blue"}, {0x19,0x19,0x70,"midnightblue"}, {0xf5,0xff,0xfa,"mint cream"}, {0xf5,0xff,0xfa,"mintcream"}, {0xff,0xe4,0xe1,"misty rose"}, {0xff,0xe4,0xe1,"mistyrose"}, {0xff,0xe4,0xe1,"mistyrose1"}, {0xee,0xd5,0xd2,"mistyrose2"}, {0xcd,0xb7,0xb5,"mistyrose3"}, {0x8b,0x7d,0x7b,"mistyrose4"}, {0xff,0xe4,0xb5,"moccasin"}, {0xff,0xde,0xad,"navajo white"}, {0xff,0xde,0xad,"navajowhite"}, {0xff,0xde,0xad,"navajowhite1"}, {0xee,0xcf,0xa1,"navajowhite2"}, {0xcd,0xb3,0x8b,"navajowhite3"}, {0x8b,0x79,0x5e,"navajowhite4"}, {0x00,0x00,0x80,"navy"}, {0x00,0x00,0x80,"navy blue"}, {0x00,0x00,0x80,"navyblue"}, {0xfd,0xf5,0xe6,"old lace"}, {0xfd,0xf5,0xe6,"oldlace"}, {0x6b,0x8e,0x23,"olive drab"}, {0x6b,0x8e,0x23,"olivedrab"}, {0xc0,0xff,0x3e,"olivedrab1"}, {0xb3,0xee,0x3a,"olivedrab2"}, {0x9a,0xcd,0x32,"olivedrab3"}, {0x69,0x8b,0x22,"olivedrab4"}, {0xff,0xa5,0x00,"orange"}, {0xff,0x45,0x00,"orange red"}, {0xff,0xa5,0x00,"orange1"}, {0xee,0x9a,0x00,"orange2"}, {0xcd,0x85,0x00,"orange3"}, {0x8b,0x5a,0x00,"orange4"}, {0xff,0x45,0x00,"orangered"}, {0xff,0x45,0x00,"orangered1"}, {0xee,0x40,0x00,"orangered2"}, {0xcd,0x37,0x00,"orangered3"}, {0x8b,0x25,0x00,"orangered4"}, {0xda,0x70,0xd6,"orchid"}, {0xff,0x83,0xfa,"orchid1"}, {0xee,0x7a,0xe9,"orchid2"}, {0xcd,0x69,0xc9,"orchid3"}, {0x8b,0x47,0x89,"orchid4"}, {0xee,0xe8,0xaa,"pale goldenrod"}, {0x98,0xfb,0x98,"pale green"}, {0xaf,0xee,0xee,"pale turquoise"}, {0xdb,0x70,0x93,"pale violet red"}, {0xee,0xe8,0xaa,"palegoldenrod"}, {0x98,0xfb,0x98,"palegreen"}, {0x9a,0xff,0x9a,"palegreen1"}, {0x90,0xee,0x90,"palegreen2"}, {0x7c,0xcd,0x7c,"palegreen3"}, {0x54,0x8b,0x54,"palegreen4"}, {0xaf,0xee,0xee,"paleturquoise"}, {0xbb,0xff,0xff,"paleturquoise1"}, {0xae,0xee,0xee,"paleturquoise2"}, {0x96,0xcd,0xcd,"paleturquoise3"}, {0x66,0x8b,0x8b,"paleturquoise4"}, {0xdb,0x70,0x93,"palevioletred"}, {0xff,0x82,0xab,"palevioletred1"}, {0xee,0x79,0x9f,"palevioletred2"}, {0xcd,0x68,0x89,"palevioletred3"}, {0x8b,0x47,0x5d,"palevioletred4"}, {0xff,0xef,0xd5,"papaya whip"}, {0xff,0xef,0xd5,"papayawhip"}, {0xff,0xda,0xb9,"peach puff"}, {0xff,0xda,0xb9,"peachpuff"}, {0xff,0xda,0xb9,"peachpuff1"}, {0xee,0xcb,0xad,"peachpuff2"}, {0xcd,0xaf,0x95,"peachpuff3"}, {0x8b,0x77,0x65,"peachpuff4"}, {0xcd,0x85,0x3f,"peru"}, {0xff,0xc0,0xcb,"pink"}, {0xff,0xb5,0xc5,"pink1"}, {0xee,0xa9,0xb8,"pink2"}, {0xcd,0x91,0x9e,"pink3"}, {0x8b,0x63,0x6c,"pink4"}, {0xdd,0xa0,0xdd,"plum"}, {0xff,0xbb,0xff,"plum1"}, {0xee,0xae,0xee,"plum2"}, {0xcd,0x96,0xcd,"plum3"}, {0x8b,0x66,0x8b,"plum4"}, {0xb0,0xe0,0xe6,"powder blue"}, {0xb0,0xe0,0xe6,"powderblue"}, {0xa0,0x20,0xf0,"purple"}, {0x9b,0x30,0xff,"purple1"}, {0x91,0x2c,0xee,"purple2"}, {0x7d,0x26,0xcd,"purple3"}, {0x55,0x1a,0x8b,"purple4"}, {0xff,0x00,0x00,"red"}, {0xff,0x00,0x00,"red1"}, {0xee,0x00,0x00,"red2"}, {0xcd,0x00,0x00,"red3"}, {0x8b,0x00,0x00,"red4"}, {0xbc,0x8f,0x8f,"rosy brown"}, {0xbc,0x8f,0x8f,"rosybrown"}, {0xff,0xc1,0xc1,"rosybrown1"}, {0xee,0xb4,0xb4,"rosybrown2"}, {0xcd,0x9b,0x9b,"rosybrown3"}, {0x8b,0x69,0x69,"rosybrown4"}, {0x41,0x69,0xe1,"royal blue"}, {0x41,0x69,0xe1,"royalblue"}, {0x48,0x76,0xff,"royalblue1"}, {0x43,0x6e,0xee,"royalblue2"}, {0x3a,0x5f,0xcd,"royalblue3"}, {0x27,0x40,0x8b,"royalblue4"}, {0x8b,0x45,0x13,"saddle brown"}, {0x8b,0x45,0x13,"saddlebrown"}, {0xfa,0x80,0x72,"salmon"}, {0xff,0x8c,0x69,"salmon1"}, {0xee,0x82,0x62,"salmon2"}, {0xcd,0x70,0x54,"salmon3"}, {0x8b,0x4c,0x39,"salmon4"}, {0xf4,0xa4,0x60,"sandy brown"}, {0xf4,0xa4,0x60,"sandybrown"}, {0x2e,0x8b,0x57,"sea green"}, {0x2e,0x8b,0x57,"seagreen"}, {0x54,0xff,0x9f,"seagreen1"}, {0x4e,0xee,0x94,"seagreen2"}, {0x43,0xcd,0x80,"seagreen3"}, {0x2e,0x8b,0x57,"seagreen4"}, {0xff,0xf5,0xee,"seashell"}, {0xff,0xf5,0xee,"seashell1"}, {0xee,0xe5,0xde,"seashell2"}, {0xcd,0xc5,0xbf,"seashell3"}, {0x8b,0x86,0x82,"seashell4"}, {0xa0,0x52,0x2d,"sienna"}, {0xff,0x82,0x47,"sienna1"}, {0xee,0x79,0x42,"sienna2"}, {0xcd,0x68,0x39,"sienna3"}, {0x8b,0x47,0x26,"sienna4"}, {0x87,0xce,0xeb,"sky blue"}, {0x87,0xce,0xeb,"skyblue"}, {0x87,0xce,0xff,"skyblue1"}, {0x7e,0xc0,0xee,"skyblue2"}, {0x6c,0xa6,0xcd,"skyblue3"}, {0x4a,0x70,0x8b,"skyblue4"}, {0x6a,0x5a,0xcd,"slate blue"}, {0x70,0x80,0x90,"slate gray"}, {0x70,0x80,0x90,"slate grey"}, {0x6a,0x5a,0xcd,"slateblue"}, {0x83,0x6f,0xff,"slateblue1"}, {0x7a,0x67,0xee,"slateblue2"}, {0x69,0x59,0xcd,"slateblue3"}, {0x47,0x3c,0x8b,"slateblue4"}, {0x70,0x80,0x90,"slategray"}, {0xc6,0xe2,0xff,"slategray1"}, {0xb9,0xd3,0xee,"slategray2"}, {0x9f,0xb6,0xcd,"slategray3"}, {0x6c,0x7b,0x8b,"slategray4"}, {0x70,0x80,0x90,"slategrey"}, {0xff,0xfa,0xfa,"snow"}, {0xff,0xfa,0xfa,"snow1"}, {0xee,0xe9,0xe9,"snow2"}, {0xcd,0xc9,0xc9,"snow3"}, {0x8b,0x89,0x89,"snow4"}, {0x00,0xff,0x7f,"spring green"}, {0x00,0xff,0x7f,"springgreen"}, {0x00,0xff,0x7f,"springgreen1"}, {0x00,0xee,0x76,"springgreen2"}, {0x00,0xcd,0x66,"springgreen3"}, {0x00,0x8b,0x45,"springgreen4"}, {0x46,0x82,0xb4,"steel blue"}, {0x46,0x82,0xb4,"steelblue"}, {0x63,0xb8,0xff,"steelblue1"}, {0x5c,0xac,0xee,"steelblue2"}, {0x4f,0x94,0xcd,"steelblue3"}, {0x36,0x64,0x8b,"steelblue4"}, {0xd2,0xb4,0x8c,"tan"}, {0xff,0xa5,0x4f,"tan1"}, {0xee,0x9a,0x49,"tan2"}, {0xcd,0x85,0x3f,"tan3"}, {0x8b,0x5a,0x2b,"tan4"}, {0xd8,0xbf,0xd8,"thistle"}, {0xff,0xe1,0xff,"thistle1"}, {0xee,0xd2,0xee,"thistle2"}, {0xcd,0xb5,0xcd,"thistle3"}, {0x8b,0x7b,0x8b,"thistle4"}, {0xff,0x63,0x47,"tomato"}, {0xff,0x63,0x47,"tomato1"}, {0xee,0x5c,0x42,"tomato2"}, {0xcd,0x4f,0x39,"tomato3"}, {0x8b,0x36,0x26,"tomato4"}, {0x40,0xe0,0xd0,"turquoise"}, {0x00,0xf5,0xff,"turquoise1"}, {0x00,0xe5,0xee,"turquoise2"}, {0x00,0xc5,0xcd,"turquoise3"}, {0x00,0x86,0x8b,"turquoise4"}, {0xee,0x82,0xee,"violet"}, {0xd0,0x20,0x90,"violet red"}, {0xd0,0x20,0x90,"violetred"}, {0xff,0x3e,0x96,"violetred1"}, {0xee,0x3a,0x8c,"violetred2"}, {0xcd,0x32,0x78,"violetred3"}, {0x8b,0x22,0x52,"violetred4"}, {0xf5,0xde,0xb3,"wheat"}, {0xff,0xe7,0xba,"wheat1"}, {0xee,0xd8,0xae,"wheat2"}, {0xcd,0xba,0x96,"wheat3"}, {0x8b,0x7e,0x66,"wheat4"}, {0xff,0xff,0xff,"white"}, {0xf5,0xf5,0xf5,"white smoke"}, {0xf5,0xf5,0xf5,"whitesmoke"}, {0xff,0xff,0x00,"yellow"}, {0x9a,0xcd,0x32,"yellow green"}, {0xff,0xff,0x00,"yellow1"}, {0xee,0xee,0x00,"yellow2"}, {0xcd,0xcd,0x00,"yellow3"}, {0x8b,0x8b,0x00,"yellow4"}, {0x9a,0xcd,0x32,"yellowgreen"} } ; static int max_rgb_names = (int) (sizeof(rgb_names)/sizeof(struct rgb_and_name) ); int rgb_color_values(char *name, unsigned char &r, unsigned char &g, unsigned char &b) { int lwb, upb, mid, found, c; if( !isalpha(name[0])) return 0; mid = 0; while((c = name[mid])) { name[mid] = tolower(c); ++mid; } lwb = 0; upb = max_rgb_names - 1; while (lwb <= upb) { mid = (lwb + upb)>>1; found = strcmp(name, rgb_names[mid].cname); if(found == 0) { r = rgb_names[mid].r; g = rgb_names[mid].g; b = rgb_names[mid].b; return 1; } if(found < 0) upb = mid - 1; else lwb = mid + 1; } r = 0; g = 0; b = 0; return 0; }// rgb_color_values()