Sign in to follow this  
Followers 0
Emperor

Problem Creating RGB Func

2 posts in this topic

MsgBox(0, "", RGB(255, 30, 30))
Exit

Func RGB($nRed, $nGreen, $nBlue)
    Return BitOR(BitOR($nRed, BitShift($nGreen, 8)), BitShift($nBlue, 16))
EndFunc

The above example should return 1974015, but no matter what I try it always returns the original red value.

What am I doing wrong?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I think I may have fixed my own problem. I found this website showing a different formula.

MsgBox(0, "", RGB(0, 255, 0))
Exit

Func RGB($iRed, $iGreen, $iBlue)
    Return ($iRed * 65536) + ($iGreen * 256) + $iBlue
EndFunc

That seems to work, maybe the other formula was for finding out BGR?

Anyways I would recommend a function like this to be added to Color.au3, it only makes sence to :D

Edit: Would anyone mind telling me if this formula is correct, I have a hunch my success will be shortlived :D

Edited by Emperor

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0