Module:The Color Printer tone/data
require('strict')
local p = {}
--[=[
Input list of colors and weights
{{color = {r, g, b}, weight = n}, ...}
Output color
{r, g, b}
Also supports RGBA
]=]
function p.weighted_color_blend(args)
local total_weight = 0
local max_len = 0
for k, v in pairs(args) do
total_weight = total_weight + v.weight
if max_len < #(v['color']) then
max_len = #(v['color'])
end
end
if total_weight == 0 then
total_weight = 1
end
max_len = math.max(max_len, 3)
local blend = {}
for i = 1, max_len do
blend[i] = 0
for k, v in pairs(args) do
blend[i] = blend[i] + v['color'][i] * v['weight']/total_weight
end
end
return blend
end
p.colorData = {
-- base colors
[1] = {
name = 'red',
rgb = {226, 81, 52} -- --
},
[2] = {
name = 'yellow',
rgb = {243, 205, 70} ----
},
[3] = {
name = 'blue',
rgb = {60, 124, 160}
},
[4] = {
name = 'orange',
rgb = {254, 166, 58}
},
[5] = {
name = 'green',
rgb = {64, 130, 109} -- Virdian from Wkipedia /* {123, 180, 135} */ --
},
[6] = {
name = 'purple',
rgb = {183,97, 142}
},
[7] = {
name = 'deep blue',
rgb = {15, 87, 127}
},
[8] = {
name = 'rose lake',
rgb = {231, 86, 115}
},
[9] = {
name = 'lemon yellow',
rgb = {236, 214, 104}
},
[10] = {
name = 'vermilion',
rgb = {227, 66,52 } -- /* {252, 120, 90} */ --
},
[11] = {
name = 'gray',
rgb = {142, 136, 112} -- --
},
[12] = {
name = 'black',
rgb = {0, 0, 0} --
},
['w'] = {
name = 'white',
rgb = {235, 238, 238} -- - work says the white used was zinc white - Approximated here --
}
}
local derived_colors = {
[13] = {{color = p['colorData'][1]['rgb'], weight = 1}, {color = p['colorData'][2]['rgb'], weight = 3}},
[14] = {{color = p['colorData'][1]['rgb'], weight = 1}, {color = p['colorData'][2]['rgb'], weight = 15}},
[15] = {{color = p['colorData'][1]['rgb'], weight = 1}, {color = p['colorData'][3]['rgb'], weight = 3}},
[16] = {{color = p['colorData'][1]['rgb'], weight = 1}, {color = p['colorData'][3]['rgb'], weight = 1}},
[17] = {{color = p['colorData'][1]['rgb'], weight = 5}, {color = p['colorData'][3]['rgb'], weight = 1}},
[18] = {{color = p['colorData'][1]['rgb'], weight = 15}, {color = p['colorData'][3]['rgb'], weight = 1}},
[19] = {{color = p['colorData'][1]['rgb'], weight = 1}, {color = p['colorData'][4]['rgb'], weight = 1}},
[20] = {{color = p['colorData'][1]['rgb'], weight = 1}, {color = p['colorData'][4]['rgb'], weight = 5}},
[21] = {{color = p['colorData'][1]['rgb'], weight = 1}, {color = p['colorData'][5]['rgb'], weight = 6}},
[22] = {{color = p['colorData'][1]['rgb'], weight = 1}, {color = p['colorData'][5]['rgb'], weight = 3}},
[23] = {{color = p['colorData'][1]['rgb'], weight = 3}, {color = p['colorData'][5]['rgb'], weight = 1}},
[24] = {{color = p['colorData'][1]['rgb'], weight = 1}, {color = p['colorData'][7]['rgb'], weight = 1}},
[25] = {{color = p['colorData'][1]['rgb'], weight = 3}, {color = p['colorData'][7]['rgb'], weight = 1}},
[27] = {{color = p['colorData'][1]['rgb'], weight = 15}, {color = p['colorData'][7]['rgb'], weight = 1}},
[28] = {{color = p['colorData'][1]['rgb'], weight = 1}, {color = p['colorData'][8]['rgb'], weight = 1}},
[29] = {{color = p['colorData'][1]['rgb'], weight = 1}, {color = p['colorData'][9]['rgb'], weight = 1}},
[30] = {{color = p['colorData'][1]['rgb'], weight = 1}, {color = p['colorData'][10]['rgb'], weight = 1}},
[31] = {{color = p['colorData'][1]['rgb'], weight = 1}, {color = p['colorData'][11]['rgb'], weight = 5}},
[32] = {{color = p['colorData'][1]['rgb'], weight = 1}, {color = p['colorData'][11]['rgb'], weight = 15}},
[33] = {{color = p['colorData'][1]['rgb'], weight = 1}, {color = p['colorData'][12]['rgb'], weight = 1}},
[34] = {{color = p['colorData'][1]['rgb'], weight = 3}, {color = p['colorData'][12]['rgb'], weight = 1}},
[35] = {{color = p['colorData'][1]['rgb'], weight = 7}, {color = p['colorData'][12]['rgb'], weight = 1}},
[36] = {{color = p['colorData'][1]['rgb'], weight = 15}, {color = p['colorData'][12]['rgb'], weight = 1}},
[37] = {{color = p['colorData'][2]['rgb'], weight = 1}, {color = p['colorData'][3]['rgb'], weight = 7}},
[38] = {{color = p['colorData'][2]['rgb'], weight = 1}, {color = p['colorData'][3]['rgb'], weight = 2}},
[39] = {{color = p['colorData'][2]['rgb'], weight = 1}, {color = p['colorData'][3]['rgb'], weight = 2}},
[40] = {{color = p['colorData'][2]['rgb'], weight = 1}, {color = p['colorData'][5]['rgb'], weight = 1}},
[41] = {{color = p['colorData'][2]['rgb'], weight = 15}, {color = p['colorData'][5]['rgb'], weight = 1}},
[42] = {{color = p['colorData'][2]['rgb'], weight = 1}, {color = p['colorData'][3]['rgb'], weight = 6}},
[43] = {{color = p['colorData'][2]['rgb'], weight = 1}, {color = p['colorData'][6]['rgb'], weight = 1}},
[44] = {{color = p['colorData'][2]['rgb'], weight = 3}, {color = p['colorData'][6]['rgb'], weight = 1}},
[45] = {{color = p['colorData'][2]['rgb'], weight = 1}, {color = p['colorData'][7]['rgb'], weight = 1}},
[46] = {{color = p['colorData'][2]['rgb'], weight = 30}, {color = p['colorData'][7]['rgb'], weight = 1}},
[47] = {{color = p['colorData'][2]['rgb'], weight = 100}, {color = p['colorData'][7]['rgb'], weight = 1}},
[48] = {{color = p['colorData'][2]['rgb'], weight = 1}, {color = p['colorData'][10]['rgb'], weight = 1}},
[49] = {{color = p['colorData'][2]['rgb'], weight = 1}, {color = p['colorData'][11]['rgb'], weight = 7}},
[50] = {{color = p['colorData'][2]['rgb'], weight = 1}, {color = p['colorData'][12]['rgb'], weight = 1}},
[51] = {{color = p['colorData'][2]['rgb'], weight = 3}, {color = p['colorData'][12]['rgb'], weight = 1}},
[52] = {{color = p['colorData'][2]['rgb'], weight = 15}, {color = p['colorData'][12]['rgb'], weight = 1}},
[53] = {{color = p['colorData'][3]['rgb'], weight = 3}, {color = p['colorData'][4]['rgb'], weight = 1}},
[54] = {{color = p['colorData'][3]['rgb'], weight = 1}, {color = p['colorData'][4]['rgb'], weight = 1}},
[55] = {{color = p['colorData'][3]['rgb'], weight = 1}, {color = p['colorData'][4]['rgb'], weight = 3}},
[56] = {{color = p['colorData'][3]['rgb'], weight = 1}, {color = p['colorData'][4]['rgb'], weight = 20}},
[57] = {{color = p['colorData'][3]['rgb'], weight = 1}, {color = p['colorData'][5]['rgb'], weight = 1}},
[58] = {{color = p['colorData'][3]['rgb'], weight = 1}, {color = p['colorData'][5]['rgb'], weight = 3}},
[59] = {{color = p['colorData'][3]['rgb'], weight = 1}, {color = p['colorData'][6]['rgb'], weight = 2}},
[60] = {{color = p['colorData'][3]['rgb'], weight = 1}, {color = p['colorData'][7]['rgb'], weight = 1}},
[61] = {{color = p['colorData'][3]['rgb'], weight = 1}, {color = p['colorData'][8]['rgb'], weight = 1}},
[62] = {{color = p['colorData'][3]['rgb'], weight = 1}, {color = p['colorData'][8]['rgb'], weight = 15}},
[63] = {{color = p['colorData'][3]['rgb'], weight = 3}, {color = p['colorData'][9]['rgb'], weight = 1}},
[64] = {{color = p['colorData'][3]['rgb'], weight = 3}, {color = p['colorData'][10]['rgb'], weight = 1}},
[65] = {{color = p['colorData'][3]['rgb'], weight = 1}, {color = p['colorData'][10]['rgb'], weight = 1}},
[66] = {{color = p['colorData'][3]['rgb'], weight = 1}, {color = p['colorData'][10]['rgb'], weight = 5}},
[67] = {{color = p['colorData'][3]['rgb'], weight = 1}, {color = p['colorData'][11]['rgb'], weight = 5}},
[68] = {{color = p['colorData'][3]['rgb'], weight = 1}, {color = p['colorData'][11]['rgb'], weight = 3}},
[71] = {{color = p['colorData'][4]['rgb'], weight = 2}, {color = p['colorData'][5]['rgb'], weight = 1}},
[72] = {{color = p['colorData'][4]['rgb'], weight = 2}, {color = p['colorData'][5]['rgb'], weight = 1}},
[73] = {{color = p['colorData'][4]['rgb'], weight = 3}, {color = p['colorData'][6]['rgb'], weight = 1}},
[74] = {{color = p['colorData'][4]['rgb'], weight = 1}, {color = p['colorData'][7]['rgb'], weight = 1}},
[75] = {{color = p['colorData'][4]['rgb'], weight = 5}, {color = p['colorData'][7]['rgb'], weight = 1}},
[76] = {{color = p['colorData'][4]['rgb'], weight = 1}, {color = p['colorData'][8]['rgb'], weight = 1}},
[77] = {{color = p['colorData'][4]['rgb'], weight = 1}, {color = p['colorData'][11]['rgb'], weight = 15}},
[78] = {{color = p['colorData'][4]['rgb'], weight = 1}, {color = p['colorData'][11]['rgb'], weight = 1}},
[79] = {{color = p['colorData'][4]['rgb'], weight = 1}, {color = p['colorData'][12]['rgb'], weight = 1}},
[80] = {{color = p['colorData'][4]['rgb'], weight = 5}, {color = p['colorData'][12]['rgb'], weight = 1}},
[81] = {{color = p['colorData'][4]['rgb'], weight = 20}, {color = p['colorData'][12]['rgb'], weight = 1}},
[82] = {{color = p['colorData'][5]['rgb'], weight = 2}, {color = p['colorData'][6]['rgb'], weight = 1}},
[83] = {{color = p['colorData'][5]['rgb'], weight = 3}, {color = p['colorData'][7]['rgb'], weight = 1}},
[84] = {{color = p['colorData'][5]['rgb'], weight = 1}, {color = p['colorData'][8]['rgb'], weight = 1}},
[85] = {{color = p['colorData'][5]['rgb'], weight = 1}, {color = p['colorData'][9]['rgb'], weight = 3}},
[86] = {{color = p['colorData'][5]['rgb'], weight = 1}, {color = p['colorData'][9]['rgb'], weight = 15}},
[87] = {{color = p['colorData'][5]['rgb'], weight = 3}, {color = p['colorData'][10]['rgb'], weight = 1}},
[88] = {{color = p['colorData'][5]['rgb'], weight = 1}, {color = p['colorData'][10]['rgb'], weight = 1}},
[89] = {{color = p['colorData'][5]['rgb'], weight = 1}, {color = p['colorData'][10]['rgb'], weight = 3}},
[90] = {{color = p['colorData'][5]['rgb'], weight = 1}, {color = p['colorData'][11]['rgb'], weight = 5}},
[91] = {{color = p['colorData'][5]['rgb'], weight = 1}, {color = p['colorData'][12]['rgb'], weight = 5}},
[92] = {{color = p['colorData'][5]['rgb'], weight = 5}, {color = p['colorData'][12]['rgb'], weight = 1}},
[93] = {{color = p['colorData'][6]['rgb'], weight = 3}, {color = p['colorData'][7]['rgb'], weight = 1}},
[94] = {{color = p['colorData'][6]['rgb'], weight = 1}, {color = p['colorData'][8]['rgb'], weight = 1}},
[95] = {{color = p['colorData'][6]['rgb'], weight = 1}, {color = p['colorData'][8]['rgb'], weight = 5}},
[96] = {{color = p['colorData'][6]['rgb'], weight = 1}, {color = p['colorData'][11]['rgb'], weight = 7}},
[97] = {{color = p['colorData'][6]['rgb'], weight = 2}, {color = p['colorData'][12]['rgb'], weight = 1}},
[98] = {{color = p['colorData'][6]['rgb'], weight = 6}, {color = p['colorData'][12]['rgb'], weight = 1}},
[99] = {{color = p['colorData'][7]['rgb'], weight = 1}, {color = p['colorData'][8]['rgb'], weight = 1}},
[100] = {{color = p['colorData'][7]['rgb'], weight = 1}, {color = p['colorData'][8]['rgb'], weight = 7}},
[101] = {{color = p['colorData'][7]['rgb'], weight = 1}, {color = p['colorData'][9]['rgb'], weight = 1}},
[102] = {{color = p['colorData'][7]['rgb'], weight = 1}, {color = p['colorData'][9]['rgb'], weight = 5}},
[103] = {{color = p['colorData'][7]['rgb'], weight = 1}, {color = p['colorData'][9]['rgb'], weight = 50}},
[104] = {{color = p['colorData'][7]['rgb'], weight = 1}, {color = p['colorData'][9]['rgb'], weight = 200}},
[105] = {{color = p['colorData'][7]['rgb'], weight = 1}, {color = p['colorData'][10]['rgb'], weight = 3}},
[106] = {{color = p['colorData'][7]['rgb'], weight = 1}, {color = p['colorData'][10]['rgb'], weight = 7}},
[107] = {{color = p['colorData'][7]['rgb'], weight = 1}, {color = p['colorData'][10]['rgb'], weight = 30}},
[108] = {{color = p['colorData'][7]['rgb'], weight = 1}, {color = p['colorData'][11]['rgb'], weight = 7}},
[109] = {{color = p['colorData'][7]['rgb'], weight = 2}, {color = p['colorData'][12]['rgb'], weight = 1}},
[110] = {{color = p['colorData'][7]['rgb'], weight = 5}, {color = p['colorData'][12]['rgb'], weight = 1}},
[111] = {{color = p['colorData'][7]['rgb'], weight = 10}, {color = p['colorData'][12]['rgb'], weight = 1}},
[112] = {{color = p['colorData'][8]['rgb'], weight = 1}, {color = p['colorData'][11]['rgb'], weight = 3}},
[113] = {{color = p['colorData'][8]['rgb'], weight = 1}, {color = p['colorData'][11]['rgb'], weight = 15}},
[114] = {{color = p['colorData'][8]['rgb'], weight = 1}, {color = p['colorData'][12]['rgb'], weight = 1}},
[115] = {{color = p['colorData'][8]['rgb'], weight = 3}, {color = p['colorData'][12]['rgb'], weight = 1}},
[116] = {{color = p['colorData'][8]['rgb'], weight = 10}, {color = p['colorData'][12]['rgb'], weight = 1}},
[117] = {{color = p['colorData'][9]['rgb'], weight = 1}, {color = p['colorData'][11]['rgb'], weight = 3}},
[118] = {{color = p['colorData'][9]['rgb'], weight = 2}, {color = p['colorData'][12]['rgb'], weight = 1}},
[119] = {{color = p['colorData'][9]['rgb'], weight = 10}, {color = p['colorData'][12]['rgb'], weight = 1}},
[120] = {{color = p['colorData'][10]['rgb'], weight = 1}, {color = p['colorData'][11]['rgb'], weight = 1}},
[121] = {{color = p['colorData'][10]['rgb'], weight = 1}, {color = p['colorData'][11]['rgb'], weight = 10}},
[122] = {{color = p['colorData'][10]['rgb'], weight = 1}, {color = p['colorData'][12]['rgb'], weight = 1}},
[123] = {{color = p['colorData'][10]['rgb'], weight = 5}, {color = p['colorData'][12]['rgb'], weight = 1}},
[124] = {{color = p['colorData'][10]['rgb'], weight = 15}, {color = p['colorData'][12]['rgb'], weight = 1}},
[125] = {{color = p['colorData'][3]['rgb'], weight = 3}, {color = p['colorData'][6]['rgb'], weight = 1}, {color = p['colorData'][7]['rgb'], weight = 1}},
[126] = {{color = p['colorData'][3]['rgb'], weight = 3}, {color = p['colorData'][6]['rgb'], weight = 3}, {color = p['colorData'][7]['rgb'], weight = 1}},
[127] = {{color = p['colorData'][3]['rgb'], weight = 1}, {color = p['colorData'][10]['rgb'], weight = 5}, {color = p['colorData'][12]['rgb'], weight = 5}},
[128] = {{color = p['colorData'][5]['rgb'], weight = 3}, {color = p['colorData'][7]['rgb'], weight = 1}, {color = p['colorData'][12]['rgb'], weight = 4}},
[129] = {{color = p['colorData'][5]['rgb'], weight = 3}, {color = p['colorData'][7]['rgb'], weight = 1}, {color = p['colorData'][12]['rgb'], weight = 1}},
[130] = {{color = p['colorData'][6]['rgb'], weight = 4}, {color = p['colorData'][7]['rgb'], weight = 1}, {color = p['colorData'][12]['rgb'], weight = 1}},
[131] = {{color = p['colorData'][6]['rgb'], weight = 1}, {color = p['colorData'][8]['rgb'], weight = 5}, {color = p['colorData'][12]['rgb'], weight = 5}},
[132] = {{color = p['colorData'][7]['rgb'], weight = 2}, {color = p['colorData'][8]['rgb'], weight = 2}, {color = p['colorData'][12]['rgb'], weight = 1}},
[133] = {{color = p['colorData'][1]['rgb'], weight = 1}, {color = p['colorData']['w']['rgb'], weight = 2}},
[134] = {{color = p['colorData'][1]['rgb'], weight = 1}, {color = p['colorData']['w']['rgb'], weight = 2}},
[149] = {{color = p['colorData'][1]['rgb'], weight = 1}, {color = p['colorData']['w']['rgb'], weight = 40}},
[150] = {{color = p['colorData'][2]['rgb'], weight = 1}, {color = p['colorData']['w']['rgb'], weight = 40}},
}
for color_key, color_components in pairs(derived_colors) do
p['colorData'][color_key] = {rgb = p.weighted_color_blend(color_components)}
end
return p