mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-13 19:50:31 +00:00
Add colours.rgb8(r, g, b)/colours.rgb8(hex)
This commit is contained in:
parent
a9e7acbec5
commit
1cc403191f
@ -35,3 +35,13 @@ end
|
|||||||
function test( colors, color )
|
function test( colors, color )
|
||||||
return ((bit32.band(colors, color)) == color)
|
return ((bit32.band(colors, color)) == color)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function rgb8( r, g, b )
|
||||||
|
if type(r) == "number" and g == nil and b == nil then
|
||||||
|
return bit32.band( bit32.rshift( r, 16 ), 0xFF ) / 255, bit32.band( bit32.rshift( r, 8 ), 0xFF ) / 255, bit32.band( r, 0xFF ) / 255
|
||||||
|
elseif type(r) == "number" and type(g) == "number" and type(b) == "number" then
|
||||||
|
return r / 255, g / 255, b / 255
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user