Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Moo
Apprentice


Joined: 10 Apr 2009
Posts: 145

PostPosted: Wed Apr 29, 2009 10:13 am   

Colour numbers/%btncol
 
There seems to be many different ways of representing colours, and trying to work out what is what and which to use where is rather difficult..
"#col Orange" makes orange text
"%btncol(b,Orange)" makes the button orange
"%btncol(b)" then returns 42495
"%colorname(Orange)" also gives 42495

But..
"#col 42495" makes a grey on grey line, and
"%btncol(b,42495)" makes a light-yellow-ish button...
"%btncol(b)" then returns 16777215...

I'm guessing it's something along the lines of.. %btncol (and #color) accepts numeric numbers in the ansi-style colour/attribute format (and named colours...), yet return them in the RGB integer format..

I would have expected it to set and return using the same format.. And for example, is there no way to make an orange button numerically?

Hm.. It seems that "%btncol(b,#FFA500)" does make an orange button.. So it accepts hex string colours too..
"%colorname(#FFA500)" gives 42495, which is right..
But.. No way to convert decimal into hex in cmud either?
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Apr 29, 2009 1:17 pm   
 
Actually, if you look at the %colorname documentation, you see
[quote]Actually returns a value in #00BBGGRR format since that is what is required by the Windows API.[code]
Apparently, this is also true of %btncol. And both the #col and %btncol documentation indicate that input colors can be specified in the numeric format returned by %color, which is the ansi-style format you mention. So yes, the input and output numbers are different, and this is documented for #col, though not for %btncol. I've just added a comment to this effect on the %btncol documentation page.
Reply with quote
Moo
Apprentice


Joined: 10 Apr 2009
Posts: 145

PostPosted: Wed Apr 29, 2009 7:53 pm   
 
But they return it as a decimal, not as a #hex string..
And #col doesn't output anything.. does it?
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Apr 29, 2009 8:49 pm   
 
Yes, sorry, I mispoke, I did not mean to imply that #color returns a value (it's not a function). However, the point is that the number returned is indeed a different format, as you have discovered. And I did not say that it returned a hexadecimal, I was simply quoting the documentation which says that it returns in #00BBGGRR format, which is not the same as #RRBBGG format. It doesn't have a # in front because it is not a hexadecimal, and it should not be confused with the hexadecimal #RRBBGG.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Thu Apr 30, 2009 4:52 pm   
 
I'm going to add some additional simple functions to the next version to make converting between the Windows color number (decimal) and the HTML Hex color string a bit easier.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net