Failed to change the "InactiveTabBackground" color by Python

hi guys!
I was trying to modify the color of Rhino interface these days by Python.
All the color change i expected had almost taken effect,
except for “Rhino.Options.UiPaintColors.InactiveTabBackground”.
Whatever color i set for InactiveTabBackground,
it just keep the default Color [A=0, R=255, G=255, B=255].

At the same time, i found something strange.
If i set a newcolor = default Color [A=0, R=255, G=255, B=255],
the codes would change “Rhino.Options.UiPaintColors.NormalEnd” color to its default.
If i set a newcolor = other color,
the codes would change “Rhino.Options.UiPaintColors.NormalEnd” color to the newcolor.

I was really confused.
I’m a beginner in Python, maybe i have not found the right way.
Here’s the codes I wrote for test.

import Rhino.ApplicationSettings.AppearanceSettings as ras
import Rhino.ApplicationSettings.PaintColor as PaintColor
import rhinoscriptsyntax as rs

newcolor = rs.CreateColor([255,255,255,0])

# PaintColor(23):InactiveTabBackground
# the codes below will not change the InactiveTabBackground color 
# but i found something strange
# if newcolor = default Color [A=0, R=255, G=255, B=255]
# the codes will change "Rhino.Options.UiPaintColors.NormalEnd" color to its default
# if newcolor = other color
# the codes will change "Rhino.Options.UiPaintColors.NormalEnd" color to newcolor

ras.SetPaintColor(PaintColor(23),newcolor)

rs.Redraw()

Can someone help me?
I will be grateful!

Hi @hubble,

to get and set this color you could to this:

import Rhino
import System
from System.Drawing import Color

# get the color
pc = Rhino.ApplicationSettings.PaintColor.InactiveTabBackground
old_color = Rhino.ApplicationSettings.AppearanceSettings.GetPaintColor(pc, True)
print "OldColor: {}".format(old_color)

# set the color
new_color = Color.FromArgb(255, 245, 245, 245)
print "NewColor: {}".format(new_color)
Rhino.ApplicationSettings.AppearanceSettings.SetPaintColor(pc, new_color, True)

_
c.

Hi @clement ,
Thanks for your patience and help !
I have learned the other way to try solving the problem from your codes.
I tested it with your codes, but the problem is still not solved.
Your codes also encountered the same problem as mine.


Hi @hubble, i can repeat this indeed, it is maybe a bug.

@dale, to repeat above, i created a screenshot of all UiPaintColors from Rhino Options / Advanced, it looked like this before:

then i ran this code and tried to change the color for InactiveTabBackground to Color.Yellow:

import Rhino
import System
from System.Drawing import Color

# set the color
new_color = Color.Yellow
print "NewColor: {}".format(new_color)
Rhino.ApplicationSettings.AppearanceSettings.SetPaintColor(pc, new_color, True)

the result is that InactiveTabBackground did not change, however it changed NormalEnd to Color.Yellow instead.

It seems that reading out InactiveTabBackground does not work, it returns the color for NormalEnd.

thanks,
c.

https://mcneel.myjetbrains.com/youtrack/issue/RH-68842

There’s this bug about InactiveTabBackground.

1 Like