mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-10-31 13:42:59 +00:00 
			
		
		
		
	Add colours.rgb8(r, g, b)/colours.rgb8(hex)
This commit is contained in:
		| @@ -25,13 +25,23 @@ function combine( ... ) | ||||
| end | ||||
|  | ||||
| function subtract( colors, ... ) | ||||
| 	local r = colors | ||||
| 	for n,c in ipairs( { ... } ) do | ||||
| 		r = bit32.band(r, bit32.bnot(c)) | ||||
| 	end | ||||
| 	return r | ||||
|     local r = colors | ||||
|     for n,c in ipairs( { ... } ) do | ||||
|         r = bit32.band(r, bit32.bnot(c)) | ||||
|     end | ||||
|     return r | ||||
| end | ||||
|  | ||||
| function test( colors, color ) | ||||
|     return ((bit32.band(colors, color)) == color) | ||||
| 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 | ||||
		Reference in New Issue
	
	Block a user
	 Lignum
					Lignum