Changing Tag Tree Browser Background & Font Colour

Could anyone assist if I could change the Tag Tree Browser Background and Font Colour. The current one is white background and font is black. I couldn’t find anything on the properties that I can change.

I need to change the Background to Black and Font to White. Appreciate if anyone could assist.

Jasonbpong

welcome to the forums

the code below will do what you need, do take time to look to see how it works.

place it in the Script Editor/internalFrame/internalFrameOpened for the window the tag tree is in, you may have to modify the path to the component to make it work for you.

[code]from java.awt import Color
from javax.swing.tree import DefaultTreeCellRenderer

cellRenderer = DefaultTreeCellRenderer()
White = Color(255,255,255,255)
black = Color(0,0,0,255)
btr = system.gui.getParentWindow(event).getComponentForPath(‘Root Container.Tag Browse Tree’)

cellRenderer.setTextNonSelectionColor(White)
cellRenderer.setTextSelectionColor(White)
cellRenderer.setBackground(black)
cellRenderer.setBackgroundNonSelectionColor(black)
cellRenderer.setBackgroundSelectionColor(black)

btr.viewport.view.background = black

btr.viewport.view.setCellRenderer(cellRenderer)
btr.setBackground(black)[/code]

I modified the code from this.

https://inductiveautomation.com/forum/viewtopic.php?f=70&t=14233&p=52321&hilit=tag+tree#p52321

you can find more info on the Java tree renderer here

https://docs.oracle.com/javase/7/docs/api/javax/swing/tree/DefaultTreeCellRenderer.html

1 Like

Dear Chris Taylor,

Appreciate your help to solve what I need.

Thanks. :smiley:

Hi
Could you please help on how can I change folder, tag icon of tag browse tree?