ZBrushCentral

Colored Text

I was doing some scripting and ran accross something very fun, and thought I would share it with the community. May add some spice to your scripts, however I recommend not abusing it.

In any text Notes, NoteBars, Buttons etc. you can change the color of the text. It is very usefull when you want to emphasize something. How you ask? Just put a \C in the line of text followed by a hexadecimal color value. ie: "This is the color \C0000FFBlue" this will look like

            This is the color Blue
Everything after the color tag will be the color you selected. If you want to go back to the default color then you just use \CC0C0C0 (at least on my machine) so we will add on to the previous like so: "This is the color \C0000FFBlue \CC0C0C0and the color \C00FF00Green"

             This is the color Blue and the color Green
Have fun, and I recommend not getting too crazy with it. You don't want it to be distracting. In fact these are the only colors I use after playing with it so far.

Orange(keyword emphasis): \CFF8800
White(keynote emphasis): \CFFFFFF
Default(on my computer): \CC0C0C0

Sweet Scripting Chris Reid

PS
If someone else already found this out, I am sorry to stomp on your parade. I did a quick search and didn’t see anything.
I saw someone had figured out the /C but they didn’t know how to control the color.

I happened accross it by accident when debugging my filenames to the notebar… My script ran accross D:/BlahBlah/…/Copy of someFileName… and colors were appearing. A little exploration and It was solved.

1 Like

…discover :smiley:

Thanks Chris, I think a lot of scripters overlook this. :wink:

I wrote my HEXcolor utility for people who want to add color to their scripts.

Cheers,

marcus_civis-
Ahh, I see you have already unlocked the secrets. I figured someone must have found this by now. Strangly enough I couldn’t find anything on the subject (can’t remember what I used as a search). Guess there is no need for the post, I will delete it.

Thanks for clarifying this. Chris Reid

[edited]
Cant figure out how to delete post. Guess I will leave it untill I get smarter…:confused:

Ahhh… but can the color of the IButton be changed?

Chris,
No need to delete. Now someone will find this when they search for ā€˜colored text’. :smiley:

Greg,
You can change button color in two ways: by using the method posted by Digits in the CODE SAMPLES thread at the top of this forum; or by using an image file for your button (in which case your image will have to include the necessary button text to identify it). You can swap images out on reload; see, for example, this zscript of mine: http://www.zbrushcentral.com/zbc/showthread.php?t=23620

Hi Marcus,
Correct me if I’m wrong.

Digits’ method will change the default color of all buttons.
If I want some buttons to be red and some to be white I need to use the ā€œImage File methodā€ used in your ztimer script.

BTW, is the ZScript Command Reference out-of-date?
I notice that the IButton description ends at the ā€œOptional HotKeyā€ parameter. yet you have the psd image following it. :smiley:

That’s right, you have to use images if you want different colors.

The command reference isn’t out of date; it just has a couple of mistakes. :wink:
If you press the Cmd button in the ZScripts menu in ZB you’ll get a list of all commands with examples - very useful.

Wait a second…
Is this supposed to give me a Blue Text of Hello inthe Button?

[IConfig,2.0]
[IShowActions,0]

[IButton, "\C0000FFHello", 
  [Note, "Test"]
]

What have I messed up?

This works for Notes and NoteBars. I havn’t tested it on IButtons. For IButtons I use an image.

INoteButtons give you the ability to already set the text & BG colors. I havn’t tested it on anything else. Maybe someone else has done this before.

Here is what you can do to test what I am referring to.
[IButton, "Hello","Hello ZBrush", 
  	[Note, "test will be blue \C0000FFTest"]
    ]

This is a better example of what can be done. You will see the hoverRectangle and the NoteBar at the top display colors.


    [IButton, "Hello","\C0000FFHello \CFF8800ZBrush", 
    	  [Note, "Test will be blue \C0000FFTest"]
    ]
    

Greg, as Chris shows you can change the colors in the popup text (and the NoteBar) but not the button text itself. You have to use images for that.