Jump to content

tocolor to RGBA


undefined

Recommended Posts

It's not work. Give warning and wrong numbers.

function tocolorToRGBA(color) 
    return bitExtract(color, 0, 8 ), bitExtract(color, 8, 8 ), bitExtract(color, 16, 8 ), bitExtract(color, 24, 8 ) -- Line 61 
end 

XLR44R.png

local r,g,b,a = tocolorToRGBA(tocolor(255,255,255,255)) 
outputChatBox(r) -- Return 3 
outputChatBox(g) -- Return 241 
outputChatBox(b) -- Return 119 
outputChatBox(a) -- Return 1 

Link to comment

I searched and didnt find anything.

Dont understand what tocolor is doing.

tocolor ( 255, 255, 255, 255 ) is equal -1

tocolor ( 0, 0, 0, 0 ) is equal 0

tocolor ( 45, 213, 31, 31 ) is equal 523097375

tocolor ( 0, 0, 0, 255 ) is equal -16777216

tocolor ( 255, 255, 255, 0 ) is equal 16777216 (the opposite)

Link to comment
It's not work. Give warning and wrong numbers.
function tocolorToRGBA(color) 
    return bitExtract(color, 0, 8 ), bitExtract(color, 8, 8 ), bitExtract(color, 16, 8 ), bitExtract(color, 24, 8 ) -- Line 61 
end 

XLR44R.png

local r,g,b,a = tocolorToRGBA(tocolor(255,255,255,255)) 
outputChatBox(r) -- Return 3 
outputChatBox(g) -- Return 241 
outputChatBox(b) -- Return 119 
outputChatBox(a) -- Return 1 

Hmm, it works for me.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...