Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/santoslove/colorchanger
LÖVE library for selecting colors
https://github.com/santoslove/colorchanger
Last synced: about 1 month ago
JSON representation
LÖVE library for selecting colors
- Host: GitHub
- URL: https://github.com/santoslove/colorchanger
- Owner: santoslove
- Created: 2017-09-18T17:16:27.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-03-21T16:08:29.000Z (over 2 years ago)
- Last Synced: 2024-08-02T06:21:39.391Z (4 months ago)
- Language: Lua
- Size: 15.6 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-love2d - colorchanger - Change the colors in your LÖVE game. (Utilities)
README
This is a LÖVE 11 library for selecting colors for your LÖVE game.
![](https://santoslove.github.io/colorchanger/colorchangerscreenshot.png)
```lua
function love.load()
if love.filesystem.getInfo('colors.lua') then
colors = require('colors')
else
colors = {
background = {.2, .2, .2},
player = {0, 1, 0},
box = {1, 0, 0},
}
endrequire('colorchanger')(colors, 'colors.lua')
endfunction love.draw()
love.graphics.setBackgroundColor(colors.background)love.graphics.setColor(colors.player)
love.graphics.circle('fill', 100, 100, 50)love.graphics.setColor(colors.box)
love.graphics.rectangle('fill', 300, 300, 100, 100)
end
```It opens a panel next to the window, so the game needs to be running in windowed mode with enough horizontal space for the panel.
Call the function returned by `require('colorchanger')` with (in any order):
* the color table to use (\_G by default)
* the file name to automatically save colors to (no file by default)
* the key to toggle the panel ('tab' by default)Change color values by scrolling or left clicking and horizontally dragging.
Set a random value by right clicking.
Lock or unlock a color by pressing the 'L' key.
Changes to the gray boxes at the top affect all unlocked colors.
The left color square is the "original" color and the right color square is the "changed" color. Left click on either to set the current color to the clicked color. Double-click on either to set the other one to the double-clicked color.
This code is [public domain](https://creativecommons.org/publicdomain/zero/1.0/), please do whatever you want with it.