Page 1 of 1

want to change icon color on click of icon

Posted: Fri Feb 03, 2023 7:53 am
by shikhar_472
Hi Oxygen Team,

I want to change the icon color on click of icon , which should feel like on/off button for action.

Thanks,
Shikhar

Re: want to change icon color on click of icon

Posted: Fri Feb 03, 2023 2:44 pm
by Gabriel Titerlea
Hello,

You can add your action to a toolbar and you can specify an HTML element as the icon for that action, on the toolbar.
See this post for an example [1].
During the actionPerformed method you can change the HTML element's look as needed.

Best,
Gabriel

[1] post63306.html#p63306

Re: want to change icon color on click of icon

Posted: Mon Feb 06, 2023 10:39 am
by shikhar_472
Hi,

I want to change the same icon image on click of actionperformed.

So the moment i will click on icon, icon image should itself change.

Thanks,
Shikhar.

Re: want to change icon color on click of icon

Posted: Mon Feb 06, 2023 6:00 pm
by mihaela
Hello,

There is a sample plugin in our Web Author samples plugin repository called web-author-autospellcheck-on-off that adds a button to the toolbar that toggles the autospellcheck state. Each time the action is performed the icon of the action changes.

You can use this code as an example:
https://github.com/oxygenxml/web-author ... /plugin.js

Best Regards,
Mihaela