rdbende / Sun-Valley-ttk-theme

A gorgeous theme for Tkinter/ttk, based on the Sun Valley visual style ✨
https://pypi.org/project/sv-ttk
MIT License
1.87k stars 110 forks source link

Can't change foreground color of `ttk.Label` #137

Open qwertychouskie opened 4 months ago

qwertychouskie commented 4 months ago

When the Sun Valley theme isn't loaded, I can change the text color of a label like this:

        style.configure("Red.Label",   foreground='red')
        style.configure("Green.Label", foreground='green')
...
    def send_all_KA(self):
        for module in self.REVModules:
            isAlive = module.sendKA()
            if isAlive == False:
                self.on_quit_button_callback()
                self.Connected_Label.config(text='Disconnected', style='Red.Label')
            else:
                self.Connected_Label.config(text='Connected', style='Green.Label')
                module.getStatus()

However, the text just stays white when the Sun Valley theme is used.

rdbende commented 3 months ago

I need to look into this, but in the meantime you can use label.config(foreground="red")

ioctl-user commented 3 months ago

I need to look into this, but in the meantime you can use label.config(foreground="red")

In recent versions I have similar problem with the style.configure() highlightcolor and foreground parameters. The foreground was working in version 2.5.3.

Could you, please, give similar advice about highlightcolor option? I need creating red border around specific Entries.

rdbende commented 3 months ago

Configuring the highlightcolor is not possible with ttk widgets. With sv-ttk you can set the "invalid" state on the entry to achieve a similar result.