This commit was automatically generated by [a script](https://gitfub.space/Jmaa/repo-manager)
105 lines
2.5 KiB
Markdown
105 lines
2.5 KiB
Markdown
<!-- WARNING! -->
|
|
<!-- THIS IS AN AUTOGENERATED FILE! -->
|
|
<!-- MANUAL CHANGES CAN AND WILL BE OVERWRITTEN! -->
|
|
|
|
# Colors
|
|
|
|
This is a collection of functions for performing color operations, designed to work with the LÖVE game engine.
|
|
|
|
## Documentation
|
|
|
|
Supports following color formats:
|
|
|
|
- `rgb255`: The standard computer representation, with each
|
|
|
|
```
|
|
channel (red, green, blue, alpha) in the [0-255] range. Alpha
|
|
channel (index 4), can either be explicit or implicit (and taken
|
|
to be 255.)
|
|
```
|
|
|
|
- `rgb1`: As above, except channels are in the [0-1] range.
|
|
- `hsl`: Hue-saturation-lightness representation (does not support alpha).
|
|
|
|
```
|
|
Hue channel is in the [0-1] range, instead of the standard [0-2*pi] range.
|
|
```
|
|
|
|
## [Functions](#Functions)
|
|
|
|
interpolate_rgb (c1, c2, t)
|
|
Interpolation
|
|
|
|
invert_rgb (color)
|
|
Inversion
|
|
|
|
parse_rgb (str)
|
|
Parsing
|
|
|
|
## Functions
|
|
|
|
interpolate_rgb (c1, c2, t)
|
|
|
|
Interpolation
|
|
|
|
Parameters:
|
|
|
|
c1
|
|
|
|
c2
|
|
|
|
t
|
|
|
|
invert_rgb (color)
|
|
|
|
Inversion
|
|
|
|
Parameters:
|
|
|
|
color
|
|
|
|
parse_rgb (str)
|
|
|
|
Parsing
|
|
|
|
Parameters:
|
|
|
|
str
|
|
Error handling
|
|
|
|
## Dependencies
|
|
|
|
This project requires [PUC Lua 5.1](https://www.tecgraf.puc-rio.br/lua/mirror/versions.html#5.1) or [LuaJIT](https://luajit.org/luajit.html). Newer versions of PUC Lua are not supported.
|
|
|
|
This project does not have any library requirements 😎
|
|
|
|
## Contributing
|
|
|
|
Feel free to submit pull requests. Please follow the [Code Conventions](CONVENTIONS.md) when doing so.
|
|
|
|
## License
|
|
|
|
```
|
|
MIT License
|
|
|
|
Copyright (c) 2017-2025 Jon Michael Aanes
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
SOFTWARE.
|
|
```
|