Module:Scientific color scheme/broc

local p = {}

colorsBroc = {
	[0] = "2c1a4c",
	[1] = "2c1b4e",
	[2] = "2c1d4f",
	[3] = "2b1e51",
	[4] = "2b2052",
	[5] = "2b2154",
	[6] = "2b2355",
	[7] = "2b2457",
	[8] = "2b2658",
	[9] = "2b275a",
	[10] = "2b295b",
	[11] = "2b2a5d",
	[12] = "2a2c5e",
	[13] = "2a2d60",
	[14] = "2a2e61",
	[15] = "2a3063",
	[16] = "2a3164",
	[17] = "2a3366",
	[18] = "293567",
	[19] = "293669",
	[20] = "29386a",
	[21] = "29396c",
	[22] = "293b6d",
	[23] = "293c6f",
	[24] = "293e71",
	[25] = "283f72",
	[26] = "284174",
	[27] = "284375",
	[28] = "284477",
	[29] = "284678",
	[30] = "28477a",
	[31] = "29497c",
	[32] = "294b7d",
	[33] = "294c7f",
	[34] = "294e80",
	[35] = "2a5082",
	[36] = "2a5183",
	[37] = "2b5385",
	[38] = "2c5586",
	[39] = "2d5788",
	[40] = "2e5889",
	[41] = "2f5a8b",
	[42] = "305c8c",
	[43] = "315e8e",
	[44] = "335f8f",
	[45] = "346191",
	[46] = "366392",
	[47] = "376593",
	[48] = "396695",
	[49] = "3b6896",
	[50] = "3d6a97",
	[51] = "3f6b99",
	[52] = "416d9a",
	[53] = "436f9b",
	[54] = "45719c",
	[55] = "47729e",
	[56] = "49749f",
	[57] = "4b76a0",
	[58] = "4d78a1",
	[59] = "5079a3",
	[60] = "527ba4",
	[61] = "547da5",
	[62] = "567fa6",
	[63] = "5880a7",
	[64] = "5b82a9",
	[65] = "5d84aa",
	[66] = "5f85ab",
	[67] = "6187ac",
	[68] = "6489ad",
	[69] = "668baf",
	[70] = "688cb0",
	[71] = "6b8eb1",
	[72] = "6d90b2",
	[73] = "6f92b3",
	[74] = "7193b5",
	[75] = "7495b6",
	[76] = "7697b7",
	[77] = "7899b8",
	[78] = "7b9bba",
	[79] = "7d9cbb",
	[80] = "7f9ebc",
	[81] = "82a0bd",
	[82] = "84a2be",
	[83] = "86a3c0",
	[84] = "89a5c1",
	[85] = "8ba7c2",
	[86] = "8da9c3",
	[87] = "90aac5",
	[88] = "92acc6",
	[89] = "94aec7",
	[90] = "97b0c8",
	[91] = "99b2ca",
	[92] = "9bb3cb",
	[93] = "9eb5cc",
	[94] = "a0b7cd",
	[95] = "a2b9ce",
	[96] = "a5bbd0",
	[97] = "a7bcd1",
	[98] = "aabed2",
	[99] = "acc0d3",
	[100] = "aec2d5",
	[101] = "b1c4d6",
	[102] = "b3c5d7",
	[103] = "b5c7d8",
	[104] = "b8c9da",
	[105] = "bacbdb",
	[106] = "bdcddc",
	[107] = "bfcfdd",
	[108] = "c2d0df",
	[109] = "c4d2e0",
	[110] = "c6d4e1",
	[111] = "c9d6e2",
	[112] = "cbd8e4",
	[113] = "ced9e5",
	[114] = "d0dbe6",
	[115] = "d2dde7",
	[116] = "d5dfe8",
	[117] = "d7e0e9",
	[118] = "d9e2ea",
	[119] = "dce4eb",
	[120] = "dee5ec",
	[121] = "e0e7ec",
	[122] = "e2e8ed",
	[123] = "e4eaed",
	[124] = "e6ebed",
	[125] = "e7eced",
	[126] = "e9eded",
	[127] = "eaeeec",
	[128] = "ebeeec",
	[129] = "ecefeb",
	[130] = "edefe9",
	[131] = "edefe8",
	[132] = "eeefe7",
	[133] = "eeefe5",
	[134] = "eeefe3",
	[135] = "edeee1",
	[136] = "edeedf",
	[137] = "eceddd",
	[138] = "ececdb",
	[139] = "ebebd9",
	[140] = "eaead6",
	[141] = "e9e9d4",
	[142] = "e8e8d2",
	[143] = "e7e7cf",
	[144] = "e6e6cd",
	[145] = "e5e5cb",
	[146] = "e4e4c8",
	[147] = "e3e2c6",
	[148] = "e1e1c4",
	[149] = "e0e0c1",
	[150] = "dfdfbf",
	[151] = "dedebd",
	[152] = "ddddba",
	[153] = "dcdbb8",
	[154] = "dadab5",
	[155] = "d9d9b3",
	[156] = "d8d8b1",
	[157] = "d7d7ae",
	[158] = "d5d5ac",
	[159] = "d4d4aa",
	[160] = "d3d3a7",
	[161] = "d2d2a5",
	[162] = "d0d0a2",
	[163] = "cfcfa0",
	[164] = "cece9e",
	[165] = "cccc9b",
	[166] = "cbcb99",
	[167] = "c9c996",
	[168] = "c8c894",
	[169] = "c6c691",
	[170] = "c5c58f",
	[171] = "c3c38c",
	[172] = "c1c18a",
	[173] = "c0bf87",
	[174] = "bebe85",
	[175] = "bcbc83",
	[176] = "baba80",
	[177] = "b8b87e",
	[178] = "b6b67c",
	[179] = "b4b479",
	[180] = "b2b277",
	[181] = "b0b075",
	[182] = "aeae73",
	[183] = "acac71",
	[184] = "aaaa6f",
	[185] = "a8a86d",
	[186] = "a6a66b",
	[187] = "a3a369",
	[188] = "a1a167",
	[189] = "9f9f65",
	[190] = "9d9d63",
	[191] = "9b9b62",
	[192] = "999960",
	[193] = "97975e",
	[194] = "95955c",
	[195] = "93935b",
	[196] = "919159",
	[197] = "8f8f57",
	[198] = "8d8d56",
	[199] = "8b8b54",
	[200] = "898952",
	[201] = "878751",
	[202] = "85854f",
	[203] = "83834d",
	[204] = "81814c",
	[205] = "7f7f4a",
	[206] = "7d7d48",
	[207] = "7b7b47",
	[208] = "797945",
	[209] = "777744",
	[210] = "757542",
	[211] = "747440",
	[212] = "72723f",
	[213] = "70703d",
	[214] = "6e6e3c",
	[215] = "6c6c3a",
	[216] = "6a6a38",
	[217] = "686837",
	[218] = "666635",
	[219] = "646434",
	[220] = "626232",
	[221] = "616031",
	[222] = "5f5f2f",
	[223] = "5d5d2d",
	[224] = "5b5b2c",
	[225] = "59592a",
	[226] = "575729",
	[227] = "555527",
	[228] = "545426",
	[229] = "525224",
	[230] = "505023",
	[231] = "4e4e21",
	[232] = "4c4c20",
	[233] = "4b4b1f",
	[234] = "49491d",
	[235] = "47471c",
	[236] = "45451a",
	[237] = "434319",
	[238] = "424218",
	[239] = "404016",
	[240] = "3e3e15",
	[241] = "3c3d14",
	[242] = "3b3b12",
	[243] = "393911",
	[244] = "373810",
	[245] = "36360f",
	[246] = "34340e",
	[247] = "32330c",
	[248] = "31310b",
	[249] = "2f300a",
	[250] = "2e2e08",
	[251] = "2c2c07",
	[252] = "2b2b05",
	[253] = "292904",
	[254] = "282802",
	[255] = "262600",
}

function rounding(i)
	if i%1 >= 0.5 then return math.ceil(i)
	else return math.floor(i)
	end
end

-- Main function
function p.main(frame)
	local args = require('Module:Arguments').getArgs(frame)
	local percent = (tonumber(args[1]) or -1)/100
	
	if (percent < 0 or percent > 1) then return silver end
	
	local shade = 127
	if (percent >= 0.1 and percent <= 0.9) then
		shade = rounding( ( (percent-0.1)/0.8 ) * 241 + 7 )
	elseif (percent < 0.1) then
		shade = rounding( percent * 7 )
	else
		shade = rounding( (percent-0.9) * 7 + 248 )
	end
	
	return ("#"..colorsBroc[255-shade]) or silver
end

return p