What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [huh?] ColorRef

[huh?] ColorRef
Author: Message:
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. Huh?  [huh?] ColorRef
Hi,

I've seen the term "ColorRef" many times, I've seen the C++ RGB macro, but is there a way to create these values myself?
08-23-2008 10:26 AM
Profile PM Find Quote Report
Volv
Skinning Contest Winner
*****

Avatar

Posts: 1233
Reputation: 31
35 / Male / Flag
Joined: Oct 2004
RE: [huh?] ColorRef
COLORREF (MSDN)
quote:
Originally posted by MSDN
When specifying an explicit RGB color, the COLORREF value has the following hexadecimal form:

0x00bbggrr

The low-order byte contains a value for the relative intensity of red; the second byte contains a value for green; and the third byte contains a value for blue. The high-order byte must be zero. The maximum value for a single byte is 0xFF.
08-23-2008 01:36 PM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: [huh?] ColorRef
So if you have a color like #FF8000 (bright yellow), the COLORREF value would be 0x000080FF. :)

Here's an equivalent for the RGB macro you're so familiar with:
code:
function RGB(r, g, b) {
   return ((b & 0xFF) << 16) | ((g & 0xFF) << 8) | (r & 0xFF);
}

This post was edited on 08-23-2008 at 01:52 PM by Matti.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
08-23-2008 01:48 PM
Profile E-Mail PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [huh?] ColorRef
A COLORREF is just a name for a DWORD value which is a concatenation of the three RGB values of a color. When you view the value in hexadecimal it is very easy to see how it is made:

0x00BBGGRR

Where BB is te blue component (a value from 0 to 255 (decimal))
Where GG is te green component (a value from 0 to 255 (decimal))
Where RR is te red component (a value from 0 to 255 (decimal))

So you can very easly make this value yourself if you know the RGB values. Just binary left shift the individual components:

var Red = 11
var Green = 22
var Blue = 33

with pure arethmetics:
var ColorRef = Blue * 256 * 256 + Green * 256 + Red
or the equivalent:
var ColorRef = (Blue << 16) + (Green << 8) + Red

in VBScript/VB you can also use the RGB() function:
ColorRef = RGB(Red, Green, Blue)

---

A COLORREF value is also used in the Plus! registry settings for some values:
http://www.msgpluslive.net/help/registry/

---

Blah, need to refresh more often again

This post was edited on 08-23-2008 at 02:19 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
08-23-2008 02:08 PM
Profile PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
O.P. RE: [huh?] ColorRef
Thanks lads :)

@ Volv:

I had already seen that page (otherwise, I wouldn't have spammed the forum again :P )
08-23-2008 02:34 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On