Extremely Simple Color Library

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
Optikk
Prole
Posts: 1
Joined: Fri Jan 12, 2018 11:24 pm

Extremely Simple Color Library

Post 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
Attachments
ColorLibrary.lua
(958 Bytes) Downloaded 284 times
Post Reply

Who is online

Users browsing this forum: No registered users and 31 guests