Page 1 of 1

Extremely Simple Color Library

Posted: Sat Jan 13, 2018 1:45 am
by Optikk
If you are experienced, you might not need to use this

Now, I know this is a really small and probably pointless library. The reason I posted it is because I use it often, and I thought maybe others would like it. It consists of a table with more tables inside of it that contain the R, G, B of common colors. It uses a single function to locate the color you want and return it. Colors can be easily added. You add the key (name) of the color to the index table and assign the rgb value to it as a table. Using it is also quite simple. After you have it required, you just enter the color name as a string for the argument and it returns the rgb which can be used directly in statements. This is an example for how it can be used:

Code: Select all

Color = require('ColorLibrary')

function love.draw()
	love.graphics.setColor(Color('red'))
end