1 | function rgb(i) |
2 | local r = bit32.band(bit32.rshift(i, 16), 255) |
3 | local g = bit32.band(bit32.rshift(i, 8), 255) |
4 | local b = bit32.band(i, 255) |
5 | return r, g, b |
6 | end |
7 | |
8 | function bright(r, g, b) |
9 | return (r+g+b)/(255*3) |
10 | end |
test run test run with input download show line numbers
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #348 |
Snippet name: | rgb functions |
Eternal ID of this version: | #348/1 |
Text MD5: | f271f57d9b63385de6c588273f73b0ed |
Author: | stefan |
Category: | |
Type: | Lua code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-01-26 00:24:41 |
Source code size: | 232 bytes / 10 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 794 / 480 |
Referenced in: | [show references] |