Skip to content

Theme switching is not smooth #1837

@Cpyte-Engine-Developer

Description

@Cpyte-Engine-Developer

MDTopAppBar change color not smoothly on theme switching

error_demo.mp4

Code and Logs

test_app.py:

from kivymd.app import MDApp


class TestApp(MDApp):
    def build(self):
        super().build()

        self.theme_cls.theme_style = "Dark"
        self.theme_cls.primary_pallete = "Blue"

main.py:

from test_app import TestApp


def main():
    TestApp().run()


if __name__ == "__main__":
    main()

test.kv:

MDScreen:
    md_bg_color: self.theme_cls.backgroundColor

    MDTopAppBar:
        type: "small"
        pos_hint: {"top": 1}

        MDTopAppBarLeadingButtonContainer:

            MDActionTopAppBarButton:
                icon: "menu"

        MDTopAppBarTitle:
            text: "AppBar Center-aligned"
            halign: "center"

        MDTopAppBarTrailingButtonContainer:

            MDActionTopAppBarButton:
                icon: "account-circle-outline"

    MDLabel:
        text: "Text"

    MDButton:
        on_press: app.theme_cls.switch_theme()
        pos_hint: {"center_x": 0.5, "center_y": 0.1}

        MDButtonText:
            text: "Switch theme"

Versions

  • OS: LMDE7
  • Python: 3.12.11
  • Kivy: 2.3.1
  • KivyMD: v2.0.1.dev0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions