Skip to main content
Participant
November 4, 2014
Question

ScriptUI: Change element back to default color

  • November 4, 2014
  • 3 replies
  • 4128 views

I have a script in which I am changing the color of StaticText, but later want to change it back to the default color. Is there a way to set it back to "default", or do I need to hard code in a color that is the same as the default? The problem is that hard coding in a number will no longer dynamically react to changes in the UI color.

var myWindGfx = myWind.grp.bottom.eight.update.graphics;

myWindGfx.foregroundColor = myWindGfx.newPen (myWindGfx.PenType.SOLID_COLOR, [1, 0, 0], 1);

This topic has been closed for replies.

3 replies

Participant
April 18, 2024

If you can't change to defaul easy, why you do not use a new brush that is transprent 100

myWindGfx.foregroundColor = myWindGfx.newPen (myWindGfx.PenType.SOLID_COLOR, [1, 0, 0], 1);

myWindGfx.foregroundColor = myWindGfx.newPen (myWindGfx.PenType.SOLID_COLOR, [1, 0, 0], 0);

 

i think this can be a cheat workaround

I hope i am not mistaken (not a advanced user)

UQg
Legend
January 24, 2015

Bump.

Have you found an answer? I'm also interested in this.

- A newly created ScriptUI element w has:

     typeof (w.graphics.foregroundColor) === 'undefined',

     so it is not possible to store the default color for later use...


- To revert back to original, none of this works:

     w.graphics.foregroundColor = void(0);                                   // error

     w.graphics.foregroundColor = null;                                        // error (sometimes crash...)

     w.graphics.foregroundColor = w.graphics.newPen();          // error (the first 2 arguments are mandatory, so there is indeed no way using PenType.SOLID_COLOR)

    

So apparently the only way would be to know the magic piece of string that would nicely complete w.graphics.newPen(w.graphics.PenType.THEME_COLOR, ?);


If someone knows ... { ! }


Xavier

Trevor:
Legend
January 25, 2015

Hi

= null works in cs but not cc

THEME_COLOR works in PS an AI but not ID :-(


The only hack is to set the background color of the whole window and make sure that all non-enabled states / images / objects keep to that color.


Trevor


Trevor:
Legend
January 25, 2015

On second thoughts on cc you could fetch the UI setting and somehow calibrate that to a rgb value for the shades of grey to black.

In Practice  most of the UI values will probably full into one of the 4 standards and there are only a possible 100 values so the calibration should be easy.

Of course this would not be updated on a palette unless you used an on idle.

You would only have to set the value of the relevant object

HTH

jeremyIFAuthor
Participant
November 5, 2014

Found what seems close, but can't get it to work.

Page 160 of http://download.macromedia.com/pub/developer/aftereffects/scripting/JavaScript-Tools-Guide-CC.pdf mentions "ScriptUIGraphics.PenType.THEME_COLOR", but no matter how i use it I get an error. Anyone have experience with THEME_COLOR?