Highlighted

How to change iconbutton highlight color?

Explorer ,
May 13, 2020

Copy link to clipboard

Copied

Hi everyone

 

I have a iconbutton in my script right now. The icon image has alpha channel, as is shown below:

Aaron_Ecthelion_0-1589374680230.png

 

When I mouse over on it, the highlight color shows, which is not really looking good.

Aaron_Ecthelion_1-1589374756968.png

The thing is, I want to change this highlight color to a darker one, like KBar.

Aaron_Ecthelion_2-1589374861101.png

This looks really nice!

 

I have been looking for ways to do this. Messing up with graphics object, brush Object a lot, but didn't succeed. It seems that we cannot change the background color of a button with some function like this:

function setBackgroundColor(uiElement, color) {
        var g = uiElement.graphics;
        var brush = g.newBrush(g.BrushType.SOLID_COLOR, color, 1);
        g.backgroundColor = brush;
    }

When it comes to buttons, code above only gives you error saying that we cannot do this.

Aaron_Ecthelion_3-1589375435336.png

 

So, can we change it via ExtendScript? What can I do to this highlight color?

If not, how can I achieve such an effect using some other methods?

 

Aaron

TOPICS
Error or problem, How to, Scripting, User interface or workspaces

Views

198

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

How to change iconbutton highlight color?

Explorer ,
May 13, 2020

Copy link to clipboard

Copied

Hi everyone

 

I have a iconbutton in my script right now. The icon image has alpha channel, as is shown below:

Aaron_Ecthelion_0-1589374680230.png

 

When I mouse over on it, the highlight color shows, which is not really looking good.

Aaron_Ecthelion_1-1589374756968.png

The thing is, I want to change this highlight color to a darker one, like KBar.

Aaron_Ecthelion_2-1589374861101.png

This looks really nice!

 

I have been looking for ways to do this. Messing up with graphics object, brush Object a lot, but didn't succeed. It seems that we cannot change the background color of a button with some function like this:

function setBackgroundColor(uiElement, color) {
        var g = uiElement.graphics;
        var brush = g.newBrush(g.BrushType.SOLID_COLOR, color, 1);
        g.backgroundColor = brush;
    }

When it comes to buttons, code above only gives you error saying that we cannot do this.

Aaron_Ecthelion_3-1589375435336.png

 

So, can we change it via ExtendScript? What can I do to this highlight color?

If not, how can I achieve such an effect using some other methods?

 

Aaron

TOPICS
Error or problem, How to, Scripting, User interface or workspaces

Views

199

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 13, 2020 0

Have something to add?

Join the conversation