Code: Select all
love.graphics.setColorF = love.graphics.setColor
function love.graphics.setColor(r,g,b,a)
r, g, b = r/255, g/255, b/255
love.graphics.setColorF(r,g,b,a)
end
Code: Select all
love.graphics.setColorF = love.graphics.setColor
function love.graphics.setColor(r,g,b,a)
r, g, b = r/255, g/255, b/255
love.graphics.setColorF(r,g,b,a)
end
Code: Select all
function setColor(r, g, b, a)
love.graphics.setColor(love.math.colorFromBytes(r, g, b, a))
end
Code: Select all
return {
black= { 0/255, 0/255, 0/255 },
navy= { 0/255, 0/255, 128/255 },
darkblue= { 0/255, 0/255, 139/255 },
maxblue = { 1/255, 163/255, 195/255},
maxlighblue = { 85/255, 222/255, 183/255},
mediumblue= { 0/255, 0/255, 205/255 },
blue= { 0/255, 0/255, 255/255 },
darkgreen= { 0/255, 100/255, 0/255 },
green= { 0/255, 128/255, 0/255 },
teal= { 0/255, 128/255, 128/255 },
darkcyan= { 0/255, 139/255, 139/255 },
deepskyblue= { 0/255, 191/255, 255/255 },
darkturquoise= { 0/255, 206/255, 209/255 },
mediumspringgreen= { 0/255, 250/255, 154/255 },
lime= { 0/255, 255/255, 0/255 },
springgreen= { 0/255, 255/255, 127/255 },
aqua= { 0/255, 255/255, 255/255 },
cyan= { 0/255, 255/255, 255/255 },
midnightblue= { 25/255, 25/255, 112/255 },
dodgerblue= { 30/255, 144/255, 255/255 },
forestgreen= { 34/255, 139/255, 34/255 },
seagreen= { 46/255, 139/255, 87/255 },
darkslategray= { 47/255, 79/255, 79/255 },
darkslategrey= { 47/255, 79/255, 79/255 },
limegreen= { 50/255, 205/255, 50/255 },
mediumseagreen= { 60/255, 179/255, 113/255 },
turquoise= { 64/255, 224/255, 208/255 },
royalblue= { 65/255, 105/255, 225/255 },
steelblue= { 70/255, 130/255, 180/255 },
darkslateblue= { 72/255, 61/255, 139/255 },
mediumturquoise= { 72/255, 209/255, 204/255 },
indigo= { 75/255, 0/255, 130/255 },
darkolivegreen= { 85/255, 107/255, 47/255 },
cadetblue= { 95/255, 158/255, 160/255 },
cornflowerblue= { 100/255, 149/255, 237/255 },
mediumaquamarine= { 102/255, 205/255, 170/255 },
dimgray= { 105/255, 105/255, 105/255 },
dimgrey= { 105/255, 105/255, 105/255 },
slateblue= { 106/255, 90/255, 205/255 },
olivedrab= { 107/255, 142/255, 35/255 },
slategray= { 112/255, 128/255, 144/255 },
slategrey= { 112/255, 128/255, 144/255 },
lightslategray= { 119/255, 136/255, 153/255 },
lightslategrey= { 119/255, 136/255, 153/255 },
mediumslateblue= { 123/255, 104/255, 238/255 },
lawngreen= { 124/255, 252/255, 0/255 },
chartreuse= { 127/255, 255/255, 0/255 },
aquamarine= { 127/255, 255/255, 212/255 },
maroon= { 128/255, 0/255, 0/255 },
purple= { 128/255, 0/255, 128/255 },
olive= { 128/255, 128/255, 0/255 },
gray= { 128/255, 128/255, 128/255 },
grey= { 128/255, 128/255, 128/255 },
skyblue= { 135/255, 206/255, 235/255 },
lightskyblue= { 135/255, 206/255, 250/255 },
blueviolet= { 138/255, 43/255, 226/255 },
darkred= { 139/255, 0/255, 0/255 },
darkmagenta= { 139/255, 0/255, 139/255 },
saddlebrown= { 139/255, 69/255, 19/255 },
darkseagreen= { 143/255, 188/255, 143/255 },
lightgreen= { 144/255, 238/255, 144/255 },
mediumpurple= { 147/255, 112/255, 216/255 },
darkviolet= { 148/255, 0/255, 211/255 },
palegreen= { 152/255, 251/255, 152/255 },
darkorchid= { 153/255, 50/255, 204/255 },
yellowgreen= { 154/255, 205/255, 50/255 },
sienna= { 160/255, 82/255, 45/255 },
brown= { 165/255, 42/255, 42/255 },
woodbrown= { 221/255, 173/255, 101/255 },
lightbrown= { 198/255, 153/255, 63/255 },
dirtbrown= { 89/255, 61/255, 41/255 },
dust = {176/255,122/255,14/255},
darkbrown= { 114/255, 65/255, 19/255 },
darkgray= { 169/255, 169/255, 169/255 },
darkgrey= { 169/255, 169/255, 169/255 },
lightblue= { 173/255, 216/255, 230/255 },
greenyellow= { 173/255, 255/255, 47/255 },
paleturquoise= { 175/255, 238/255, 238/255 },
lightsteelblue= { 176/255, 196/255, 222/255 },
powderblue= { 176/255, 224/255, 230/255 },
firebrick= { 178/255, 34/255, 34/255 },
darkgoldenrod= { 184/255, 134/255, 11/255 },
mediumorchid= { 186/255, 85/255, 211/255 },
rosybrown= { 188/255, 143/255, 143/255 },
darkkhaki= { 189/255, 183/255, 107/255 },
silver= { 192/255, 192/255, 192/255 },
mediumvioletred= { 199/255, 21/255, 133/255 },
indianred= { 205/255, 92/255, 92/255 },
peru= { 205/255, 133/255, 63/255 },
chocolate= { 210/255, 105/255, 30/255 },
tan= { 210/255, 180/255, 140/255 },
lightgray= { 211/255, 211/255, 211/255 },
lightgrey= { 211/255, 211/255, 211/255 },
palevioletred= { 216/255, 112/255, 147/255 },
thistle= { 216/255, 191/255, 216/255 },
orchid= { 218/255, 112/255, 214/255 },
goldenrod= { 218/255, 165/255, 32/255 },
crimson= { 220/255, 20/255, 60/255 },
gainsboro= { 220/255, 220/255, 220/255 },
plum= { 221/255, 160/255, 221/255 },
burlywood= { 222/255, 184/255, 135/255 },
lightcyan= { 224/255, 255/255, 255/255 },
lavender= { 230/255, 230/255, 250/255 },
darksalmon= { 233/255, 150/255, 122/255 },
violet= { 238/255, 130/255, 238/255 },
palegoldenrod= { 238/255, 232/255, 170/255 },
lightcoral= { 240/255, 128/255, 128/255 },
khaki= { 240/255, 230/255, 140/255 },
aliceblue= { 240/255, 248/255, 255/255 },
honeydew= { 240/255, 255/255, 240/255 },
azure= { 240/255, 255/255, 255/255 },
sandybrown= { 244/255, 164/255, 96/255 },
wheat= { 245/255, 222/255, 179/255 },
beige= { 245/255, 245/255, 220/255 },
whitesmoke= { 245/255, 245/255, 245/255 },
mintcream= { 245/255, 255/255, 250/255 },
ghostwhite= { 248/255, 248/255, 255/255 },
salmon= { 250/255, 128/255, 114/255 },
antiquewhite= { 250/255, 235/255, 215/255 },
linen= { 250/255, 240/255, 230/255 },
lightgoldenrodyellow= { 250/255, 250/255, 210/255 },
oldlace= { 253/255, 245/255, 230/255 },
red= { 255/255, 0/255, 0/255 },
fuchsia= { 255/255, 0/255, 255/255 },
magenta= { 255/255, 0/255, 255/255 },
deeppink= { 255/255, 20/255, 147/255 },
orangered= { 255/255, 69/255, 0/255 },
tomato= { 255/255, 99/255, 71/255 },
hotpink= { 255/255, 105/255, 180/255 },
coral= { 255/255, 127/255, 80/255 },
darkorange= { 255/255, 140/255, 0/255 },
lightsalmon= { 255/255, 160/255, 122/255 },
orange= { 255/255, 165/255, 0/255 },
lightpink= { 255/255, 182/255, 193/255 },
pink= { 255/255, 192/255, 203/255 },
gold= { 255/255, 215/255, 0/255 },
peachpuff= { 255/255, 218/255, 185/255 },
navajowhite= { 255/255, 222/255, 173/255 },
moccasin= { 255/255, 228/255, 181/255 },
bisque= { 255/255, 228/255, 196/255 },
mistyrose= { 255/255, 228/255, 225/255 },
blanchedalmond= { 255/255, 235/255, 205/255 },
papayawhip= { 255/255, 239/255, 213/255 },
lavenderblush= { 255/255, 240/255, 245/255 },
seashell= { 255/255, 245/255, 238/255 },
cornsilk= { 255/255, 248/255, 220/255 },
lemonchiffon= { 255/255, 250/255, 205/255 },
floralwhite= { 255/255, 250/255, 240/255 },
snow= { 255/255, 250/255, 250/255 },
yellow= { 255/255, 255/255, 0/255 },
lightyellow= { 255/255, 255/255, 224/255 },
ivory= { 255/255, 255/255, 240/255 },
white= { 255/255, 255/255, 255/255 }
}
Code: Select all
function getColor(color)
return colors[color]
end
This should be explicitly mentioned (hint) in the wiki at:slime wrote: ↑Fri Dec 31, 2021 9:21 pm You can also use love.math.colorFromBytes, and your own function instead of overwriting setColor (since doing so would break any other code that uses it, including library code):Code: Select all
function setColor(r, g, b, a) love.graphics.setColor(love.math.colorFromBytes(r, g, b, a)) end
Cool, thanks.pgimeno wrote: ↑Sun Jan 09, 2022 11:51 pm I've added an example and a See Also entry in love.graphics.setColor.
Users browsing this forum: No registered users and 2 guests