|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Thu Apr 03, 2008 2:02 am
Color |
How do I specify specific colors? I don't like using the limits of color names, I'd prefer to color using the RGB system (255,255,255) but I dont know precisely it works out.
#REGEX {^You tell the group '.*'} {#COLOR <blank>} |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Thu Apr 03, 2008 2:38 am |
The help is my friend. You should read it sometime.
Quote: |
Supports numeric values generated with the %color function, desciptive values including those listed in the %colorname function, and RGB values in hexadecimal format preceded by a $. |
#COLOR
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Thu Apr 03, 2008 3:38 am |
I read that, my trigger still didn't fire and it does a terrible job of explaining how the RGB workds in CMUD (why can't it just be (x,y,x) ?
|
|
|
|
Dharkael Enchanter
Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Thu Apr 03, 2008 7:09 am |
There are numerous sites out there that can help you convert your RGB values to Hex values
Just do a search for RGB to Hex
You'll enter something like 255,255,204 and it will return FFFFCC
your #COLOR command then becomes.
#COLOR $FFFFCC
chamenas wrote: |
...(why can't it just be (x,y,x) ? |
If it was (x,y,z) someone would be asking "Why can't be Hex?" |
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Thu Apr 03, 2008 8:40 am |
Dharkael wrote: |
There are numerous sites out there that can help you convert your RGB values to Hex values
Just do a search for RGB to Hex
You'll enter something like 255,255,204 and it will return FFFFCC
your #COLOR command then becomes.
#COLOR $FFFFCC
chamenas wrote: |
...(why can't it just be (x,y,x) ? |
If it was (x,y,z) someone would be asking "Why can't be Hex?" |
aka, why can't it be both! |
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Thu Apr 03, 2008 11:31 am |
I don't use the hex codes, ever. I only use the HTML color names. Much clearer when reading my code, and I don't have to play around with any hex values.
|
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Thu Apr 03, 2008 12:07 pm |
Color names are limiting. Not to mention, the red default isn't red. It's dark red....
|
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Thu Apr 03, 2008 9:44 pm |
Quote: |
aka, why can't it be both! |
Zugg really shouldn't spend his time trying to intentionally make it so everything allows 6 different of doing it. The zScript language itself is usually flexible enough that there are multiple ways to do any given thing. The power of that language is in the user hands.
Quote: |
I read that, my trigger still didn't fire... |
Making the trigger fire has nothing to do with the #COLOR command or your original question. Please refer to the various helps #TRIGGER #REGEX and their related topics.
Quote: |
...it does a terrible job of explaining how the RGB workds in CMUD... |
Yep, a little vague, but that is by design. I actually wrote that particular piece of the help system a number of years ago. I figured that I really should add a reference to a mostly unknown syntax there. I also decided that it should be vague enough so that I wouldn't have to answer tons of support questions about it. Since then I seen many users make use of it on the forums. I would have to say that the way it was written is just right.
Now, since zScript is so wonderfully flexible, here is a function you can use to extend all your uses of #COLOR, #CW, #SUB, #PSUB, etc.
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<func name="RGB" type="Literal" copy="yes">
<value>#RESULT ""
$Val=(($Red*256+$Green)*256+$Blue)
$Ret=%mss(%concat("Hex(",$Val,")"))
#IF (%len($Ret)<=6) {#RETURN %left(%concat("#",%rightback(%concat("000000",$Ret),6)),7)}</value>
<arglist>$Red, $Green, $Blue</arglist>
</func>
</cmud> |
I am sure you will notice that I used # instead of the documented $ for signalling the hex number. This is actually very intentional because MXP uses the pound. The various #COLOR command actually support it, but I never added it to the documentation because there were occasional parsing problems with it in zMud. Perhaps both characters deserve to be documented for CMud, but I will worry about that later.
Enjoy, and a general vague apology for sounding rude earlier. Bad days at work throw my entire life off. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Apr 03, 2008 10:49 pm |
Quote: |
Not to mention, the red default isn't red. It's dark red.... |
That's because of zMUD compatibility. In this case, "red" is referring to your ANSI color code. So it's dark red because that is what color you have assigned to your ANSI "red" code. If you want the HTML color, you can use the name "mxpred". This only happens for the cases where the HTML color name was the same as the ANSI color name. I had to preserve the ANSI color as the default for compatibility.
Quote: |
(why can't it just be (x,y,x) ? |
Because CMUD supports *STANDARDS*. The #RRGGBB format is the standard used for HTML and web pages. Is is the most common system used to specify RGB color values for programmers (as opposed to graphics artists who have about fifty million ways to specify color values, and CMUD isn't Photoshop!). The (x,y,z) format isn't used by any software that I can think of off the top of my head. And as people have already mentioned, you can always write your own function to do that.
But CMUD is supporting the web standards. The color names are HTML standard names, and the RGB syntax is the HTML standard for colors. |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Fri Apr 04, 2008 2:13 am |
But I use photoshop, and I use it well. I use rgb(x,y,z) in all my CSS :P
|
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Fri Apr 04, 2008 2:22 am |
Vijilante provided you with a CMUD function that will allow you to do @RGB(x, y, z) in your #COLOR command parameter, so there you go!
|
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Fri Apr 04, 2008 2:35 am |
I completely missed it. But I need to look at it and understand how it works first. And I'm in a bad mood myself right now.
|
|
|
|
|
|