Skip navigation
Currently Being Moderated

Text colors and autoThemeColorChange

Jun 26, 2012 10:45 AM

Creating an extension for CS6 I'm using

 

CSInterface.instance.autoThemeColorChange = true;

 

at start and it looks nice but I have a problem with:

 

Alert messages and my own popup windows: the background is almost white and text gray, really hard to read.

 

Text in the status bar: docs are telling that statusBar and statusText are skin parts but I can't find how to change them. I could only set the blend mode to screen to make it lighter.

 

Thanks in advance for any help

 
Replies
  • Currently Being Moderated
    Jun 28, 2012 1:32 AM   in reply to MSSDedalus

    Hi,

    I'm afraid you have to change them manually.

    First you should listen for:

     

    CSInterface.instance.addEventListener(AppReskinEvent.APPLICATION_RESKI N, eventHandler);

     

    then, having defined previously these vars:

     

    public var hostEnv:HostEnvironment;

    public var eSkin:AppSkinInfo;

     

    you set a eventHandler that:

     

    hostEnv = CSInterface.instance.hostEnvironment;

    eSkin = hostEnv.appSkinInfo;

     

    so that eSkin contains valuable information (please see the EB doc in the Programmers Guide - Customizing the User Interface).

     

    styleManager.getStyleDeclaration("mx.controls.Alert").setStyle("backgr oundColor", UIColor2Hex(model.eSkin.panelBackgroundColor));

     

    where the UIColor2Hex() is a function I made to transform a UIColor into Hex, as follows:

     

    function UIColor2Hex(rgb:UIColor):String {

                                  var red:uint = rgb.color.red;

                                  var green:uint = rgb.color.green;

                                  var blue:uint = rgb.color.blue;

     

                                  var intVal:int = red << 16 | green << 8 | blue;

                                  var hexVal:String = "#" + intVal.toString(16);

     

                                  return hexVal;

                        }

     

    So you should be able to set the Alert's background color to match the panel's color. The same applies for Fonts, etc (use a conditional to find out if you're on a dark or light theme - as far as I know there's no actual "flag", you have to test it yourself against panel's properties).

     

    Using .getStyleDeclaration() and .setStyle() you'll be able to style pretty much everything you need in order to provide a consistent look throughout your extension.

     

    Regards,

     

    Davide

    www.davidebarranca.com

     

    =========

    UPDATE: it seems the Forum's editor puts random whitespaces in the code, please remove them if you copy&paste ;-)

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 28, 2012 6:59 AM   in reply to MSSDedalus

    Yes, you're right - I forgot to mention that, when the application is launched, you need to check what is the current theme and reskin your components accordingly.

    Glad to have been of some help! ;-)

    Davide

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 5, 2012 12:36 AM   in reply to DBarranca

    It seems that for Photoshop there's another, effective way (via ActionManager code) to get the interface color as string: "DarkGray", "MediumGray", "LightGray", "Original".

    You can find the code in ps-scripts forum here.

     

    Davide

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points