mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-12 19:20:29 +00:00
colours.rgb8(r,g,b) and colours.rgb8(c) are now the inverse of each other
This commit is contained in:
parent
5f22d8bac6
commit
0b8b39ced0
@ -40,8 +40,11 @@ function rgb8( r, g, b )
|
|||||||
if type(r) == "number" and g == nil and b == nil then
|
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
|
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
|
elseif type(r) == "number" and type(g) == "number" and type(b) == "number" then
|
||||||
return r / 255, g / 255, b / 255
|
return
|
||||||
|
bit32.lshift( bit32.band(r * 255, 0xFF), 16 ) +
|
||||||
|
bit32.lshift( bit32.band(g * 255, 0xFF), 8 ) +
|
||||||
|
bit32.band(b * 255 0xFF)
|
||||||
else
|
else
|
||||||
return nil
|
error( "Expected 1 or 3 numbers" )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user