Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

modify colors of SettingsWithSidebar

39 views
Skip to first unread message

Joerg B

unread,
Mar 22, 2025, 5:39:56 AMMar 22
to Kivy users support
Hi, 
I am wondering how to modify the colors of the font used in the sidebar.
In my .kv I am modifying the Button like this:

<Button>
    background_normal:app.get_asset_path(app.theme.button_normal)
    background_color:app.color('button')
    color:app.color("font")
    on_press: app.background_color(self, 1)
    on_release: app.background_color(self, 0)

The problem now is, that when using a light theme with a black font on the button, the sidebar of the settings screen is all black.

So far I could only figure that I can change the content on the right with:
<SettingString>: 
      Label:

How do I control the buttons used for the sidebar? 
Is there any documentation about that? I wasn't able to find much so far.

Thanks a lot in advance
Joerg

Joerg B

unread,
Mar 22, 2025, 6:03:51 AMMar 22
to Kivy users support
I just figured It's not the button thing I'm doing, it's modifying Label. 
I can easily work around that. 

Joerg B

unread,
Mar 22, 2025, 11:20:36 AMMar 22
to Kivy users support
I could sort it out by myself.
In case anyone else will have this question:
Everything to adapt the colors of the settings page is in:

.../site_packages/kivy/data/style.kv 



اجم خان سودری

unread,
Mar 23, 2025, 9:57:26 AMMar 23
to kivy-...@googlegroups.com

from kivy.uix.settings import SettingsWithSidebar

class MyApp(App):
    def build(self):
        self.settings_screen = SettingsWithSidebar()
        return self.settings_screen

    def on_theme_change(self, new_theme):
        # Adjust sidebar color when theme changes
        sidebar = self.settings_screen.children[0]  # Assuming it's the first child
        sidebar.background_color = self.color('background')  # Use app theme color


--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/kivy-users/421622fa-67cc-4ce3-85c8-213fdb927176n%40googlegroups.com.

Joerg B

unread,
Mar 23, 2025, 10:48:49 AMMar 23
to Kivy users support
thanks for showing me that way. 
I was actually thinking too complicated. In the end I simply changed the background color of the whole settings screen. All widgets in use there are already modified anyways. 
I added this to my .kv:

<Settings>:
    orientation: 'horizontal'
    canvas.before:
        Color:
            rgb: app.color("background")
        Rectangle:
            pos: self.pos
            size: self.size

Now it's got the look and feel of the rest of the app.

elli...@cox.net

unread,
Mar 23, 2025, 11:08:50 AMMar 23
to kivy-...@googlegroups.com
I would recommend you add a "-" to the kivy rule.  This redefines the widgets style.  

<-Settings>:

    orientation: 'horizontal'
    canvas.before:
        Color:
            rgb: app.color("background")
        Rectangle:
            pos: self.pos
            size: self.size



From: kivy-...@googlegroups.com <kivy-...@googlegroups.com> on behalf of Joerg B <clochar...@gmail.com>
Sent: Sunday, March 23, 2025 7:48 AM
To: Kivy users support <kivy-...@googlegroups.com>
Subject: Re: [kivy-users] modify colors of SettingsWithSidebar
 

Joerg B

unread,
Mar 23, 2025, 11:15:07 AMMar 23
to Kivy users support
didn't know that, thanks!
Reply all
Reply to author
Forward
0 new messages