chroma-js
Version:
JavaScript library for color conversions
234 lines (212 loc) • 33.1 kB
JavaScript
/*
test script for chroma.js
*/
var colors = [];
colors.push( ['indigo', '#4b0082', [75, 0, 130], [274.6153846153846, 1.0, 0.5098039215686274], [274.6153846153846, 1.0, 0.2549019607843137], [0.20469619540964282, 0.5069785658117896, -0.6457015857054634]] );
colors.push( ['gold', '#ffd700', [255, 215, 0], [50.588235294117645, 1.0, 1.0], [50.588235294117645, 1.0, 0.5], [0.869285847161576, -0.040324964123069074, 0.7839179912639622]] );
colors.push( ['hotpink', '#ff69b4', [255, 105, 180], [330.0, 0.5882352941176471, 1.0], [330.0, 1.0, 0.7058823529411764], [0.6548186958181393, 0.6226781163449963, -0.25293762142619935]] );
colors.push( ['firebrick', '#b22222', [178, 34, 34], [0.0, 0.8089887640449438, 0.6980392156862745], [0.0, 0.679245283018868, 0.4156862745098039], [0.3911257274771978, 0.5452708220538329, 0.32093749465000343]] );
colors.push( ['indianred', '#cd5c5c', [205, 92, 92], [0.0, 0.551219512195122, 0.803921568627451], [0.0, 0.5305164319248827, 0.5823529411764706], [0.533911485087161, 0.4319453160241449, 0.126671494437246]] );
colors.push( ['yellow', '#ffff00', [255, 255, 0], [60.0, 1.0, 1.0], [60.0, 1.0, 0.5], [0.9713824698129728, -0.23780527703102572, 0.8474399178854406]] );
colors.push( ['mistyrose', '#ffe4e1', [255, 228, 225], [6.000000000000032, 0.11764705882352944, 1.0], [6.000000000000032, 1.0, 0.9411764705882353], [0.9265558901260385, 0.06475028339154587, -0.12845161916854098]] );
colors.push( ['darkolivegreen', '#556b2f', [85, 107, 47], [82.0, 0.5607476635514018, 0.4196078431372549], [82.0, 0.3896103896103896, 0.3019607843137255], [0.422340254244788, -0.19936567451476567, 0.23838142240543336]] );
colors.push( ['olive', '#808000', [128, 128, 0], [60.0, 1.0, 0.5019607843137255], [60.0, 1.0, 0.25098039215686274], [0.5186833136334822, -0.14265244311379877, 0.5083544662583052]] );
colors.push( ['darkseagreen', '#8fbc8f', [143, 188, 143], [120.0, 0.23936170212765961, 0.7372549019607844], [120.0, 0.2513966480446928, 0.6490196078431373], [0.7208740631745534, -0.2551643282398808, 0.05073744962074245]] );
colors.push( ['pink', '#ffc0cb', [255, 192, 203], [349.5238095238095, 0.24705882352941178, 1.0], [349.5238095238095, 1.0, 0.8764705882352941], [0.835847988577587, 0.2198572455249609, -0.1298741606573286]] );
colors.push( ['tomato', '#ff6347', [255, 99, 71], [9.13043478260869, 0.7215686274509804, 1.0], [9.13043478260869, 1.0, 0.6392156862745098], [0.6220136881808274, 0.5597639539876859, 0.3785648778098243]] );
colors.push( ['lightcoral', '#f08080', [240, 128, 128], [0.0, 0.4666666666666667, 0.9411764705882353], [0.0, 0.7887323943661971, 0.7215686274509804], [0.6615316216626996, 0.4092289243880759, 0.07726808414975594]] );
colors.push( ['orangered', '#ff4500', [255, 69, 0], [16.235294117647054, 1.0, 1.0], [16.235294117647054, 1.0, 0.5], [0.5757499421872108, 0.6595833012162139, 0.6336728901859965]] );
colors.push( ['navajowhite', '#ffdead', [255, 222, 173], [35.85365853658537, 0.32156862745098036, 1.0], [35.85365853658537, 1.0, 0.8392156862745098], [0.9010007935356519, 0.023087319962676878, 0.13289651161984417]] );
colors.push( ['lime', '#00ff00', [0, 255, 0], [120.0, 1.0, 1.0], [120.0, 1.0, 0.5], [0.8773703347354421, -0.8790739595343378, 0.7391783167663408]] );
colors.push( ['palegreen', '#98fb98', [152, 251, 152], [120.0, 0.3944223107569721, 0.984313725490196], [120.0, 0.9252336448598131, 0.7901960784313725], [0.9075103714758299, -0.5026205428870661, 0.24433166784888294]] );
colors.push( ['darkslategrey', '#2f4f4f', [47, 79, 79], [180.0, 0.4050632911392405, 0.30980392156862746], [180.0, 0.25396825396825395, 0.24705882352941178], [0.3125607829935253, -0.1263359766345401, -0.1197661954584095]] );
colors.push( ['greenyellow', '#adff2f', [173, 255, 47], [83.65384615384615, 0.8156862745098039, 1.0], [83.65384615384615, 1.0, 0.592156862745098], [0.9195763180408608, -0.544542093550705, 0.7177078866859454]] );
colors.push( ['burlywood', '#deb887', [222, 184, 135], [33.79310344827586, 0.3918918918918919, 0.8705882352941177], [33.79310344827586, 0.5686274509803922, 0.7], [0.7701689872654847, 0.05105154515888555, 0.1739091129145518]] );
colors.push( ['seashell', '#fff5ee', [255, 245, 238], [24.705882352941195, 0.06666666666666665, 1.0], [24.705882352941195, 1.0, 0.9666666666666667], [0.9712111642889012, -0.0017046204941173482, -0.1389942778284945]] );
colors.push( ['mediumspringgreen', '#00fa9a', [0, 250, 154], [156.96, 1.0, 0.9803921568627451], [156.96, 1.0, 0.49019607843137253], [0.873411479783456, -0.7247291827447444, 0.18351016532202635]] );
colors.push( ['fuchsia', '#ff00ff', [255, 0, 255], [300.0, 1.0, 1.0], [300.0, 1.0, 0.5], [0.6031993366407601, 0.9621520899903963, -0.7947397373009382]] );
colors.push( ['papayawhip', '#ffefd5', [255, 239, 213], [37.14285714285714, 0.16470588235294115, 1.0], [37.14285714285714, 1.0, 0.9176470588235295], [0.9507544110280505, -0.010165807758992784, -0.02620215572575857]] );
colors.push( ['blanchedalmond', '#ffebcd', [255, 235, 205], [35.99999999999998, 0.196078431372549, 1.0], [35.99999999999998, 1.0, 0.9019607843137255], [0.9391948969581234, -0.0013766556305516708, 0.0031584110792990394]] );
colors.push( ['chartreuse', '#7fff00', [127, 255, 0], [90.11764705882354, 1.0, 1.0], [90.11764705882354, 1.0, 0.5], [0.8987420853068859, -0.6992231451485814, 0.7641412438139024]] );
colors.push( ['dimgray', '#696969', [105, 105, 105], [0.0, 0.0, 0.4117647058823529], [0.0, 0.0, 0.4117647058823529], [0.44413560147816006, -0.01240111926738674, -0.10090846978269519]] );
colors.push( ['black', '#000000', [0, 0, 0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]] );
colors.push( ['peachpuff', '#ffdab9', [255, 218, 185], [28.285714285714278, 0.27450980392156865, 1.0], [28.285714285714278, 1.0, 0.8627450980392157], [0.8934875285782702, 0.0588294466121303, 0.05462512377596762]] );
colors.push( ['springgreen', '#00ff7f', [0, 255, 127], [149.88235294117646, 1.0, 1.0], [149.88235294117646, 1.0, 0.5], [0.8847265520282772, -0.7868317437649452, 0.3413854976247239]] );
colors.push( ['aquamarine', '#7fffd4', [127, 255, 212], [159.84375, 0.5019607843137255, 1.0], [159.84375, 1.0, 0.7490196078431373], [0.9203615371984776, -0.47526010813046693, -0.07382626209160459]] );
colors.push( ['white', '#ffffff', [255, 255, 255], [0.0, 0.0, 1.0], [0.0, 0.0, 1.0], [1.0, -0.023811373332364716, -0.19375422448458002]] );
colors.push( ['orange', '#ffa500', [255, 165, 0], [38.82352941176471, 1.0, 1.0], [38.82352941176471, 1.0, 0.5], [0.7493219484533533, 0.21951135041202663, 0.7142144893657811]] );
colors.push( ['lightsalmon', '#ffa07a', [255, 160, 122], [17.142857142857135, 0.5215686274509803, 1.0], [17.142857142857135, 1.0, 0.7392156862745098], [0.7470287844017, 0.29466471456882193, 0.2274513181769613]] );
colors.push( ['darkslategray', '#2f4f4f', [47, 79, 79], [180.0, 0.4050632911392405, 0.30980392156862746], [180.0, 0.25396825396825395, 0.24705882352941178], [0.3125607829935253, -0.1263359766345401, -0.1197661954584095]] );
colors.push( ['brown', '#a52a2a', [165, 42, 42], [0.0, 0.7454545454545455, 0.6470588235294118], [0.0, 0.5942028985507247, 0.40588235294117647], [0.37521829744034335, 0.48361517821840033, 0.24562719432350144]] );
colors.push( ['ivory', '#fffff0', [255, 255, 240], [60.0, 0.05882352941176472, 1.0], [60.0, 1.0, 0.9705882352941176], [0.9963977381109994, -0.04913728863395639, -0.11458523080180139]] );
colors.push( ['dodgerblue', '#1e90ff', [30, 144, 255], [209.6, 0.8823529411764706, 1.0], [209.6, 1.0, 0.5588235294117647], [0.5938172567788059, 0.08371236808400961, -0.8211633809268937]] );
colors.push( ['peru', '#cd853f', [205, 133, 63], [29.577464788732396, 0.6926829268292682, 0.803921568627451], [29.577464788732396, 0.5867768595041323, 0.5254901960784314], [0.6175166368426567, 0.19696907376237915, 0.39576684351930214]] );
colors.push( ['lawngreen', '#7cfc00', [124, 252, 0], [90.47619047619048, 1.0, 0.9882352941176471], [90.47619047619048, 1.0, 0.49411764705882355], [0.8887798766318886, -0.6969272158069101, 0.7567275336364283]] );
colors.push( ['chocolate', '#d2691e', [210, 105, 30], [24.999999999999996, 0.8571428571428571, 0.8235294117647058], [24.999999999999996, 0.7499999999999999, 0.47058823529411764], [0.5598605299432203, 0.3540045567999345, 0.5022081478159983]] );
colors.push( ['crimson', '#dc143c', [220, 20, 60], [348.0, 0.9090909090909092, 0.8627450980392157], [348.0, 0.8333333333333335, 0.47058823529411764], [0.4702980511087303, 0.6930055769965837, 0.26325918231898526]] );
colors.push( ['forestgreen', '#228b22', [34, 139, 34], [120.0, 0.7553956834532375, 0.5450980392156862], [120.0, 0.6069364161849712, 0.33921568627450976], [0.5059443111773344, -0.5071969228682052, 0.38257731130873285]] );
colors.push( ['darkgrey', '#a9a9a9', [169, 169, 169], [0.0, 0.0, 0.6627450980392157], [0.0, 0.0, 0.6627450980392157], [0.6923779560557699, -0.017496801493036007, -0.14237226710632545]] );
colors.push( ['lightseagreen', '#20b2aa', [32, 178, 170], [176.71232876712327, 0.8202247191011236, 0.6980392156862745], [176.71232876712327, 0.6952380952380952, 0.4117647058823529], [0.6578768757989991, -0.39012191342691405, -0.20602491745261475]] );
colors.push( ['cyan', '#00ffff', [0, 255, 255], [180.0, 1.0, 1.0], [180.0, 1.0, 0.5], [0.9111652110946342, -0.5005376689702995, -0.3338805946768746]] );
colors.push( ['mintcream', '#f5fffa', [245, 255, 250], [149.99999999999991, 0.039215686274509776, 1.0], [149.99999999999991, 1.0, 0.9803921568627452], [0.9915659662605986, -0.06507166014994514, -0.17867117893042384]] );
colors.push( ['silver', '#c0c0c0', [192, 192, 192], [0.0, 0.0, 0.7529411764705882], [0.0, 0.0, 0.7529411764705882], [0.7770436358995272, -0.01923473779579299, -0.1565139336051069]] );
colors.push( ['antiquewhite', '#faebd7', [250, 235, 215], [34.28571428571427, 0.13999999999999996, 0.9803921568627451], [34.28571428571427, 0.7777777777777779, 0.9117647058823529], [0.9373077088204487, -0.004234640328935058, -0.0568554561123944]] );
colors.push( ['mediumorchid', '#ba55d3', [186, 85, 211], [288.0952380952381, 0.5971563981042654, 0.8274509803921568], [288.0952380952381, 0.5887850467289718, 0.580392156862745], [0.5364213313573549, 0.5735794949902978, -0.636310342650839]] );
colors.push( ['skyblue', '#87ceeb', [135, 206, 235], [197.4, 0.42553191489361697, 0.9215686274509803], [197.4, 0.714285714285714, 0.7254901960784313], [0.792089745909287, -0.16720049545562388, -0.39238755364937594]] );
colors.push( ['gray', '#808080', [128, 128, 128], [0.0, 0.0, 0.5019607843137255], [0.0, 0.0, 0.5019607843137255], [0.5358501345216902, -0.014283747703854877, -0.11622750273425964]] );
colors.push( ['darkturquoise', '#00ced1', [0, 206, 209], [180.86124401913872, 1.0, 0.8196078431372549], [180.86124401913872, 1.0, 0.40980392156862744], [0.7529307531314078, -0.41723355791884353, -0.3006792164804286]] );
colors.push( ['goldenrod', '#daa520', [218, 165, 32], [42.903225806451616, 0.8532110091743119, 0.8549019607843137], [42.903225806451616, 0.744, 0.49019607843137253], [0.7081571317667877, 0.06698295804747678, 0.6093022300110145]] );
colors.push( ['darkgreen', '#006400', [0, 100, 0], [120.0, 1.0, 0.39215686274509803], [120.0, 1.0, 0.19607843137254902], [0.3620351872497332, -0.44237580708234386, 0.37197621532378644]] );
colors.push( ['floralwhite', '#fffaf0', [255, 250, 240], [39.999999999999964, 0.05882352941176472, 1.0], [39.999999999999964, 1.0, 0.9705882352941176], [0.9840143252802201, -0.023851763735045495, -0.13211387214288806]] );
colors.push( ['darkviolet', '#9400d3', [148, 0, 211], [282.085308056872, 1.0, 0.8274509803921568], [282.085308056872, 1.0, 0.4137254901960784], [0.3957886745488794, 0.748286597336516, -0.8647020187032046]] );
colors.push( ['darkgray', '#a9a9a9', [169, 169, 169], [0.0, 0.0, 0.6627450980392157], [0.0, 0.0, 0.6627450980392157], [0.6923779560557699, -0.017496801493036007, -0.14237226710632545]] );
colors.push( ['moccasin', '#ffe4b5', [255, 228, 181], [38.10810810810812, 0.2901960784313725, 1.0], [38.10810810810812, 1.0, 0.8549019607843138], [0.9172208952705462, 0.002144955264661852, 0.10921124568580454]] );
colors.push( ['saddlebrown', '#8b4513', [139, 69, 19], [24.999999999999996, 0.8633093525179856, 0.5450980392156862], [24.999999999999996, 0.759493670886076, 0.3098039215686274], [0.3746692024400533, 0.25220380008356025, 0.3602831255614455]] );
colors.push( ['grey', '#808080', [128, 128, 128], [0.0, 0.0, 0.5019607843137255], [0.0, 0.0, 0.5019607843137255], [0.5358501345216902, -0.014283747703854877, -0.11622750273425964]] );
colors.push( ['darkslateblue', '#483d8b', [72, 61, 139], [248.46153846153842, 0.5611510791366905, 0.5450980392156862], [248.46153846153842, 0.3899999999999999, 0.39215686274509803], [0.308292872096168, 0.24970648748732366, -0.5398113313571685]] );
colors.push( ['lightskyblue', '#87cefa', [135, 206, 250], [202.9565217391304, 0.45999999999999996, 0.9803921568627451], [202.9565217391304, 0.92, 0.7549019607843137], [0.7972503275959484, -0.1274096752659598, -0.47250171427895826]] );
colors.push( ['lightpink', '#ffb6c1', [255, 182, 193], [350.95890410958907, 0.28627450980392155, 1.0], [350.95890410958907, 1.0, 0.8568627450980393], [0.8105253594361856, 0.2583881265702831, -0.10689017280265789]] );
colors.push( ['mediumvioletred', '#c71585', [199, 21, 133], [322.24719101123594, 0.8944723618090452, 0.7803921568627451], [322.24719101123594, 0.809090909090909, 0.43137254901960786], [0.44761625451383064, 0.6941785666352301, -0.2679532555045854]] );
colors.push( ['slategrey', '#708090', [112, 128, 144], [210.0, 0.2222222222222222, 0.5647058823529412], [210.0, 0.12598425196850394, 0.5019607843137255], [0.5283625796271889, -0.035445006750154384, -0.23092417400252185]] );
colors.push( ['red', '#ff0000', [255, 0, 0], [0.0, 1.0, 1.0], [0.0, 1.0, 0.5], [0.5323288178584246, 0.7830269697286946, 0.6217119704129933]] );
colors.push( ['deeppink', '#ff1493', [255, 20, 147], [327.5744680851064, 0.9215686274509804, 1.0], [327.5744680851064, 1.0, 0.5392156862745098], [0.5595428053659428, 0.8267244418805686, -0.18279412987354493]] );
colors.push( ['limegreen', '#32cd32', [50, 205, 50], [120.0, 0.7560975609756098, 0.803921568627451], [120.0, 0.607843137254902, 0.5], [0.7260854102811316, -0.6862939720025885, 0.5259428411898455]] );
colors.push( ['darkmagenta', '#8b008b', [139, 0, 139], [300.0, 1.0, 0.5450980392156862], [300.0, 1.0, 0.2725490196078431], [0.3259748369188065, 0.6126599992634216, -0.5060585035722]] );
colors.push( ['palegoldenrod', '#eee8aa', [238, 232, 170], [54.70588235294117, 0.28571428571428575, 0.9333333333333333], [54.70588235294117, 0.6666666666666667, 0.8], [0.9114038954621267, -0.09516278682884738, 0.16077358877963555]] );
colors.push( ['plum', '#dda0dd', [221, 160, 221], [300.0, 0.27601809954751133, 0.8666666666666667], [300.0, 0.4728682170542637, 0.7470588235294118], [0.733727428092835, 0.3054520868570204, -0.3904598149735128]] );
colors.push( ['turquoise', '#40e0d0', [64, 224, 208], [174.0, 0.7142857142857143, 0.8784313725490196], [174.0, 0.7207207207207207, 0.5647058823529412], [0.8126705459794431, -0.4586688468859401, -0.20661992607659108]] );
colors.push( ['lightgrey', '#d3d3d3', [211, 211, 211], [0.0, 0.0, 0.8274509803921568], [0.0, 0.0, 0.8274509803921568], [0.845561167363605, -0.020641200314330255, -0.1679583828916762]] );
colors.push( ['lightgoldenrodyellow', '#fafad2', [250, 250, 210], [60.0, 0.16, 0.9803921568627451], [60.0, 0.8000000000000002, 0.9019607843137254], [0.9736879732328357, -0.08779282901519359, 0.02165635524055176]] );
colors.push( ['darkgoldenrod', '#b8860b', [184, 134, 11], [42.65895953757226, 0.9402173913043479, 0.7215686274509804], [42.65895953757226, 0.8871794871794872, 0.38235294117647056], [0.592185428516686, 0.08271256910030333, 0.5625183105871953]] );
colors.push( ['lavender', '#e6e6fa', [230, 230, 250], [240.0, 0.07999999999999995, 0.9803921568627451], [240.0, 0.6666666666666666, 0.9411764705882353], [0.9182769059829122, 0.014778815237324605, -0.28607882110696914]] );
colors.push( ['maroon', '#800000', [128, 0, 0], [0.0, 1.0, 0.5019607843137255], [0.0, 1.0, 0.25098039215686274], [0.25530784572416176, 0.46971501915502034, 0.3615580363298282]] );
colors.push( ['yellowgreen', '#9acd32', [154, 205, 50], [79.74193548387098, 0.7560975609756098, 0.803921568627451], [79.74193548387098, 0.607843137254902, 0.5], [0.765351984302265, -0.397124806620171, 0.5758612973839754]] );
colors.push( ['sandybrown', '#f4a460', [244, 164, 96], [27.567567567567572, 0.6065573770491803, 0.9568627450980393], [27.567567567567572, 0.8705882352941179, 0.6666666666666667], [0.7395154071958171, 0.21070055869783222, 0.3630145602694952]] );
colors.push( ['thistle', '#d8bfd8', [216, 191, 216], [300.0, 0.11574074074074073, 0.8470588235294118], [300.0, 0.24271844660194178, 0.7980392156862746], [0.8007734471203902, 0.11183890070923297, -0.2617170677911038]] );
colors.push( ['violet', '#ee82ee', [238, 130, 238], [300.0, 0.45378151260504207, 0.9333333333333333], [300.0, 0.7605633802816902, 0.7215686274509804], [0.6969362286537106, 0.5433651317870464, -0.5469384794686774]] );
colors.push( ['navy', '#000080', [0, 0, 128], [240.0, 1.0, 0.5019607843137255], [240.0, 1.0, 0.25098039215686274], [0.12975311577716514, 0.4668493755239564, -0.7580582346884601]] );
colors.push( ['magenta', '#ff00ff', [255, 0, 255], [300.0, 1.0, 1.0], [300.0, 1.0, 0.5], [0.6031993366407601, 0.9621520899903963, -0.7947397373009382]] );
colors.push( ['dimgrey', '#696969', [105, 105, 105], [0.0, 0.0, 0.4117647058823529], [0.0, 0.0, 0.4117647058823529], [0.44413560147816006, -0.01240111926738674, -0.10090846978269519]] );
colors.push( ['tan', '#d2b48c', [210, 180, 140], [34.2857142857143, 0.33333333333333326, 0.8235294117647058], [34.2857142857143, 0.4374999999999999, 0.6862745098039216], [0.7497454643298407, 0.03128263304649992, 0.11599493962207941]] );
colors.push( ['rosybrown', '#bc8f8f', [188, 143, 143], [0.0, 0.23936170212765961, 0.7372549019607844], [0.0, 0.2513966480446928, 0.6490196078431373], [0.636060381979233, 0.15298113890650444, -0.06047798840060392]] );
colors.push( ['olivedrab', '#6b8e23', [107, 142, 35], [79.62616822429906, 0.7535211267605634, 0.5568627450980392], [79.62616822429906, 0.6045197740112994, 0.34705882352941175], [0.5465077397646714, -0.2954214285464396, 0.4270824627768418]] );
colors.push( ['blue', '#0000ff', [0, 0, 255], [240.0, 1.0, 1.0], [240.0, 1.0, 0.5], [0.32302586667249483, 0.7782498683858613, -1.263702496577161]] );
colors.push( ['lightblue', '#add8e6', [173, 216, 230], [194.73684210526315, 0.24782608695652172, 0.9019607843137255], [194.73684210526315, 0.5327102803738316, 0.7901960784313726], [0.8381410256512628, -0.12887659976118626, -0.2925939943835818]] );
colors.push( ['ghostwhite', '#f8f8ff', [248, 248, 255], [240.0, 0.027450980392156876, 1.0], [240.0, 1.0, 0.9862745098039216], [0.977572735023453, -0.010935428731224661, -0.22670473440514338]] );
colors.push( ['honeydew', '#f0fff0', [240, 255, 240], [120.0, 0.05882352941176472, 1.0], [120.0, 1.0, 0.9705882352941176], [0.9856580137512647, -0.09881341672271504, -0.13129565181155223]] );
colors.push( ['cornflowerblue', '#6495ed', [100, 149, 237], [218.54014598540147, 0.5780590717299579, 0.9294117647058824], [218.54014598540147, 0.7919075144508672, 0.6607843137254902], [0.6192818670495679, 0.07695028591197639, -0.6708859320216507]] );
colors.push( ['slateblue', '#6a5acd', [106, 90, 205], [248.34782608695653, 0.5609756097560975, 0.803921568627451], [248.34782608695653, 0.5348837209302326, 0.5784313725490197], [0.4533730589003685, 0.3461558027361977, -0.736135895124236]] );
colors.push( ['linen', '#faf0e6', [250, 240, 230], [30.0, 0.07999999999999995, 0.9803921568627451], [30.0, 0.6666666666666666, 0.9411764705882353], [0.9531120096478846, -0.006159079901049691, -0.11986846581016453]] );
colors.push( ['darkblue', '#00008b', [0, 0, 139], [240.0, 1.0, 0.5450980392156862], [240.0, 1.0, 0.2725490196078431], [0.14757156815274186, 0.4955584140515651, -0.8046752469558895]] );
colors.push( ['powderblue', '#b0e0e6', [176, 224, 230], [186.66666666666669, 0.2347826086956522, 0.9019607843137255], [186.66666666666669, 0.5192307692307692, 0.7960784313725491], [0.8613359115282357, -0.16121573218191132, -0.25841525646822694]] );
colors.push( ['seagreen', '#2e8b57', [46, 139, 87], [146.45161290322582, 0.6690647482014388, 0.5450980392156862], [146.45161290322582, 0.5027027027027026, 0.3627450980392157], [0.5153535112854968, -0.40914059856571316, 0.10716907292412658]] );
colors.push( ['darkkhaki', '#bdb76b', [189, 183, 107], [55.609756097560975, 0.4338624338624339, 0.7411764705882353], [55.609756097560975, 0.38317757009345804, 0.5803921568627451], [0.7338127833356914, -0.10584036545325415, 0.2817092493927382]] );
colors.push( ['snow', '#fffafa', [255, 250, 250], [0.0, 0.019607843137254943, 1.0], [0.0, 1.0, 0.9901960784313726], [0.986437639483644, -0.007044251018588632, -0.18504647800175533]] );
colors.push( ['sienna', '#a0522d', [160, 82, 45], [19.304347826086957, 0.7187499999999999, 0.6274509803921569], [19.304347826086957, 0.5609756097560975, 0.4019607843137255], [0.43796139581025684, 0.27956748089949524, 0.29104963154284613]] );
colors.push( ['mediumblue', '#0000cd', [0, 0, 205], [240.0, 1.0, 0.803921568627451], [240.0, 1.0, 0.4019607843137255], [0.24976157230438928, 0.6602066508618176, -1.0720268988690291]] );
colors.push( ['royalblue', '#4169e1', [65, 105, 225], [225.0, 0.7111111111111111, 0.8823529411764706], [225.0, 0.7272727272727272, 0.5686274509803921], [0.47832847506564635, 0.24835460173600277, -0.822457690091565]] );
colors.push( ['lightcyan', '#e0ffff', [224, 255, 255], [180.0, 0.1215686274509804, 1.0], [180.0, 1.0, 0.9392156862745098], [0.9786814756512815, -0.12234371395565213, -0.2272058317444956]] );
colors.push( ['green', '#008000', [0, 128, 0], [120.0, 1.0, 0.5019607843137255], [120.0, 1.0, 0.25098039215686274], [0.46228817842626585, -0.5273308043073138, 0.44341149237704724]] );
colors.push( ['mediumpurple', '#9370db', [147, 112, 219], [259.6261682242991, 0.4885844748858447, 0.8588235294117647], [259.6261682242991, 0.5977653631284916, 0.6490196078431372], [0.5497523587308041, 0.3517193423064019, -0.6679804314029127]] );
colors.push( ['midnightblue', '#191970', [25, 25, 112], [240.0, 0.7767857142857143, 0.4392156862745098], [240.0, 0.635036496350365, 0.26862745098039215], [0.15859552026439894, 0.30913171919011967, -0.596968570204917]] );
colors.push( ['cornsilk', '#fff8dc', [255, 248, 220], [47.999999999999986, 0.13725490196078427, 1.0], [47.999999999999986, 1.0, 0.9313725490196079], [0.9745526614880223, -0.0453737058528364, -0.032718606088457]] );
colors.push( ['paleturquoise', '#afeeee', [175, 238, 238], [180.0, 0.2647058823529412, 0.9333333333333333], [180.0, 0.6494845360824743, 0.8098039215686275], [0.9006142407788806, -0.21721389023431736, -0.2473380034885535]] );
colors.push( ['bisque', '#ffe4c4', [255, 228, 196], [32.54237288135594, 0.2313725490196078, 1.0], [32.54237288135594, 1.0, 0.884313725490196], [0.920124490871158, 0.02191222939985915, 0.02812529766482963]] );
colors.push( ['slategray', '#708090', [112, 128, 144], [210.0, 0.2222222222222222, 0.5647058823529412], [210.0, 0.12598425196850394, 0.5019607843137255], [0.5283625796271889, -0.035445006750154384, -0.23092417400252185]] );
colors.push( ['darkcyan', '#008b8b', [0, 139, 139], [180.0, 1.0, 0.5450980392156862], [180.0, 1.0, 0.2725490196078431], [0.5220751981599829, -0.3187223840107434, -0.21260181941801592]] );
colors.push( ['khaki', '#f0e68c', [240, 230, 140], [54.0, 0.41666666666666663, 0.9411764705882353], [54.0, 0.7692307692307692, 0.7450980392156863], [0.9032729582034387, -0.11153426871098715, 0.3157921548494451]] );
colors.push( ['wheat', '#f5deb3', [245, 222, 179], [39.09090909090909, 0.2693877551020409, 0.9607843137254902], [39.09090909090909, 0.7674418604651168, 0.8313725490196078], [0.8935068099788126, -0.006601174686367006, 0.0873735604290291]] );
colors.push( ['teal', '#008080', [0, 128, 128], [180.0, 1.0, 0.5019607843137255], [180.0, 1.0, 0.25098039215686274], [0.4825607381337552, -0.3002579347294454, -0.20028522131041826]] );
colors.push( ['darkorchid', '#9932cc', [153, 50, 204], [280.12987012987014, 0.7549019607843138, 0.8], [280.12987012987014, 0.6062992125984252, 0.4980392156862745], [0.43379266957801366, 0.6363387903080925, -0.758414265443792]] );
colors.push( ['deepskyblue', '#00bfff', [0, 191, 255], [195.05882352941177, 1.0, 1.0], [195.05882352941177, 1.0, 0.5], [0.7254923231908798, -0.19385456304862436, -0.6144946785102139]] );
colors.push( ['salmon', '#fa8072', [250, 128, 114], [6.1764705882352855, 0.5439999999999999, 0.9803921568627451], [6.1764705882352855, 0.9315068493150683, 0.7137254901960784], [0.6725995258561211, 0.43305320226222743, 0.18004205501353154]] );
colors.push( ['darkred', '#8b0000', [139, 0, 0], [0.0, 1.0, 0.5450980392156862], [0.0, 1.0, 0.2725490196078431], [0.28084732284208996, 0.4986002812736287, 0.39017555990006514]] );
colors.push( ['steelblue', '#4682b4', [70, 130, 180], [207.2727272727273, 0.611111111111111, 0.7058823529411765], [207.2727272727273, 0.44, 0.4901960784313726], [0.524674724151205, -0.05459261337357357, -0.4674493655295482]] );
colors.push( ['palevioletred', '#db7093', [219, 112, 147], [340.3738317757009, 0.4885844748858447, 0.8588235294117647], [340.3738317757009, 0.5977653631284916, 0.6490196078431372], [0.6056478786766126, 0.4373511704710342, -0.12351319542694061]] );
colors.push( ['lightslategray', '#778899', [119, 136, 153], [210.0, 0.22222222222222218, 0.6], [210.0, 0.14285714285714285, 0.5333333333333333], [0.559173493720072, -0.037120779306640816, -0.24196040198659263]] );
colors.push( ['aliceblue', '#f0f8ff', [240, 248, 255], [208.0, 0.05882352941176472, 1.0], [208.0, 1.0, 0.9705882352941176], [0.9717890760827637, -0.036650243973827545, -0.23579921187220854]] );
colors.push( ['lightslategrey', '#778899', [119, 136, 153], [210.0, 0.22222222222222218, 0.6], [210.0, 0.14285714285714285, 0.5333333333333333], [0.559173493720072, -0.037120779306640816, -0.24196040198659263]] );
colors.push( ['lightgreen', '#90ee90', [144, 238, 144], [120.0, 0.39495798319327735, 0.9333333333333333], [120.0, 0.734375, 0.7490196078431373], [0.8654957590580997, -0.48216182058181345, 0.23403231878404873]] );
colors.push( ['orchid', '#da70d6', [218, 112, 214], [302.2641509433962, 0.4862385321100917, 0.8549019607843137], [302.2641509433962, 0.5888888888888889, 0.6470588235294117], [0.628009876658991, 0.5340872687499026, -0.5090414830717489]] );
colors.push( ['gainsboro', '#dcdcdc', [220, 220, 220], [0.0, 0.0, 0.8627450980392157], [0.0, 0.0, 0.8627450980392157], [0.8776088811005116, -0.021299045207638923, -0.1733112966171917]] );
colors.push( ['mediumseagreen', '#3cb371', [60, 179, 113], [146.72268907563026, 0.664804469273743, 0.7019607843137254], [146.72268907563026, 0.49790794979079495, 0.46862745098039216], [0.6527341001550978, -0.49658724902962637, 0.1307134141415025]] );
colors.push( ['lightgray', '#d3d3d3', [211, 211, 211], [0.0, 0.0, 0.8274509803921568], [0.0, 0.0, 0.8274509803921568], [0.845561167363605, -0.020641200314330255, -0.1679583828916762]] );
colors.push( ['mediumturquoise', '#48d1cc', [72, 209, 204], [177.8102189781022, 0.6555023923444976, 0.8196078431372549], [177.8102189781022, 0.5982532751091703, 0.5509803921568628], [0.768834686242291, -0.3908692872148878, -0.24675655397247076]] );
colors.push( ['lemonchiffon', '#fffacd', [255, 250, 205], [53.999999999999986, 0.196078431372549, 1.0], [53.999999999999986, 1.0, 0.9019607843137255], [0.976476983766357, -0.07735929175768319, 0.05405973707263745]] );
colors.push( ['cadetblue', '#5f9ea0', [95, 158, 160], [181.84615384615384, 0.40625, 0.6274509803921569], [181.84615384615384, 0.2549019607843137, 0.5], [0.6115461539950293, -0.21168495467245974, -0.21025211079573736]] );
colors.push( ['lightyellow', '#ffffe0', [255, 255, 224], [60.0, 0.1215686274509804, 1.0], [60.0, 1.0, 0.9392156862745098], [0.9928483637693047, -0.07450950728687789, -0.029802916768408405]] );
colors.push( ['lavenderblush', '#fff0f5', [255, 240, 245], [339.99999999999994, 0.05882352941176472, 1.0], [339.99999999999994, 1.0, 0.9705882352941176], [0.9606837944039779, 0.0355916525256017, -0.19370394009509373]] );
colors.push( ['coral', '#ff7f50', [255, 127, 80], [16.114285714285714, 0.6862745098039216, 1.0], [16.114285714285714, 1.0, 0.6568627450980392], [0.6729048083264605, 0.4343154623847062, 0.38184090118838054]] );
colors.push( ['purple', '#800080', [128, 0, 128], [300.0, 1.0, 0.5019607843137255], [300.0, 1.0, 0.25098039215686274], [0.29782100092098074, 0.5771669493535714, -0.47674116647464704]] );
colors.push( ['aqua', '#00ffff', [0, 255, 255], [180.0, 1.0, 1.0], [180.0, 1.0, 0.5], [0.9111652110946342, -0.5005376689702995, -0.3338805946768746]] );
colors.push( ['whitesmoke', '#f5f5f5', [245, 245, 245], [0.0, 0.0, 0.9607843137254902], [0.0, 0.0, 0.9607843137254902], [0.9653748961423614, -0.023100622233548362, -0.18797081056592946]] );
colors.push( ['mediumslateblue', '#7b68ee', [123, 104, 238], [248.50746268656715, 0.5630252100840336, 0.9333333333333333], [248.50746268656715, 0.7976190476190477, 0.6705882352941177], [0.5215750471109439, 0.3948145035859696, -0.8311558565524511]] );
colors.push( ['darkorange', '#ff8c00', [255, 140, 0], [32.94117647058824, 1.0, 1.0], [32.94117647058824, 1.0, 0.5], [0.6948104411888189, 0.34896572220421307, 0.6853471779496086]] );
colors.push( ['mediumaquamarine', '#66cdaa', [102, 205, 170], [159.61165048543688, 0.5024390243902439, 0.803921568627451], [159.61165048543688, 0.5073891625615764, 0.6019607843137256], [0.756931293906138, -0.4003580926511374, -0.06200079595011698]] );
colors.push( ['darksalmon', '#e9967a', [233, 150, 122], [15.135135135135133, 0.4763948497854077, 0.9137254901960784], [15.135135135135133, 0.7161290322580643, 0.696078431372549], [0.6985346453844176, 0.2627837710604447, 0.16055410339996024]] );
colors.push( ['beige', '#f5f5dc', [245, 245, 220], [60.0, 0.10204081632653059, 0.9607843137254902], [60.0, 0.555555555555556, 0.911764705882353], [0.959488798865349, -0.06472124048008843, -0.0548212338667704]] );
colors.push( ['blueviolet', '#8a2be2', [138, 43, 226], [271.1475409836065, 0.8097345132743362, 0.8862745098039215], [271.1475409836065, 0.7593360995850621, 0.5274509803921569], [0.4218810476642369, 0.6832764245495992, -0.9172721008740032]] );
colors.push( ['azure', '#f0ffff', [240, 255, 255], [180.0, 0.05882352941176472, 1.0], [180.0, 1.0, 0.9705882352941176], [0.9893278063011066, -0.07216332394606617, -0.21048624190304288]] );
colors.push( ['lightsteelblue', '#b0c4de', [176, 196, 222], [213.91304347826087, 0.20720720720720723, 0.8705882352941177], [213.91304347826087, 0.41071428571428575, 0.7803921568627451], [0.7845233742822654, -0.03212707859202413, -0.32460574178167767]] );
colors.push( ['oldlace', '#fdf5e6', [253, 245, 230], [39.130434782608695, 0.09090909090909093, 0.9921568627450981], [39.130434782608695, 0.8518518518518523, 0.9470588235294117], [0.9677967120416257, -0.0214561895514237, -0.09880175419085213]] );
try {
var chroma = require('../chroma.min.js'),col;
for (var h=0;h<360;h+=10) {
col = chroma.hsv(h,.5,.5);
//console.log(h, col.lab()[1], col.lab()[2], col.hcl()[0]);
}
// colors = [];
for (var c in colors) {
var col, f = colors[c], out = [],
hex = f[1], rgb = f[2], hsv = f[3], hsl = f[4], lab=f[5];
out.push(['rgb array', chroma.rgb(rgb)]);
out.push(['rgb', chroma.rgb(rgb[0], rgb[1], rgb[2])]);
out.push(['hex', chroma.hex(hex)]);
out.push(['hsv array', chroma.hsv(hsv)]);
out.push(['hsv', chroma.hsv(hsv[0], hsv[1], hsv[2])]);
out.push(['hsl array', chroma.hsl(hsl)]);
out.push(['hsl', chroma.hsl(hsl[0], hsl[1], hsl[2])]);
out.push(['lab array', chroma.lab(lab)]);
out.push(['lab', chroma.lab(lab[0], lab[1], lab[2])]);
// */
var lab2hcl = chroma.Color.lab2hcl, hcl2lab = chroma.Color.hcl2lab;
for (var o in out) {
var c = out[o][1], orgb = c.rgb, ohex = c.hex(),
ohsv = c.hsv(), ohsl = c.hsl(), olab = c.lab();
var equals = function(a,b) {
for (var i in a) {
if (isNaN(a[i])) a[i] = 0;
if (isNaN(b[i])) b[i] = 0;
var x = Math.round(a[i]*100000);
var y = Math.round(b[i]*100000);
if (x != y) return false;
}
return true;
};
if (!equals(orgb, rgb)) {
throw ''+out[o][0]+' to rgb conversion at '+f[0]+' '+orgb+' '+lab+' '+rgb
}
if (ohex.toLowerCase() != hex.toLowerCase()) {
throw ''+out[o][0]+' to hex conversion at '+f[0]+' '+hex+' '+ohex
}
if (!equals(ohsv, hsv)) {
throw ''+out[o][0]+' to hsv conversion at '+f[0]+' '+hsv+' '+ohsv
}
if (!equals(ohsl, hsl)) {
throw ''+out[o][0]+' to hsl conversion at '+f[0]+' '+hsl+' '+ohsl
}
if (!equals(olab, lab)) {
throw ''+out[o][0]+' to lab conversion at '+f[0]+' '+lab+' '+olab
}
var _lab = hcl2lab(lab2hcl(lab));
if (!equals(lab, _lab)) {
throw 'hcl conversion failed for '+f[0]+' '+lab+' '+_lab
return;
}
}
}
//console.log(hcl2rgb(rgb2hcl(255,0,0)))
} catch (er) {
console.error('Error:. '+er+'\007');
console.log(er.stack);
}