kivymd / KivyMD

KivyMD is a collection of Material Design compliant widgets for use with Kivy, a framework for cross-platform, touch-enabled graphical applications. https://youtube.com/c/KivyMD https://twitter.com/KivyMD https://habr.com/ru/users/kivymd https://stackoverflow.com/tags/kivymd
https://kivymd.readthedocs.io
MIT License
2.21k stars 664 forks source link

When changing the theme, my palette created with path_wallpaper is missing. #1625

Closed Furio0124 closed 7 months ago

Furio0124 commented 7 months ago

I set the palette using an image, but when changing the theme, the palette is set by default or from the primary_pallete attribute.

  from kivymd.app import MDApp
  from kivy.lang import Builder

  KV = """
  MDScreen:

      MDButton:
          pos_hint: {"center_x": .5, "center_y": .5}
          theme_bg_color: "Custom"
          md_bg_color: app.theme_cls.primaryColor
          on_release: app.theme_cls.switch_theme()

  """

  class uiApp(MDApp):
      def build(self):
          self.theme_cls.dynamic_color = True
          self.theme_cls.path_to_wallpaper = 'path/to/image'
          return Builder.load_string(KV)

  uiApp().run()

image image

T-Dynamos commented 7 months ago

Not reproducible on latest commit. Test code:

from kivymd.app import MDApp
from kivy.lang import Builder

KV = """
MDScreen:
    md_bg_color:app.theme_cls.surfaceColor
    MDButton:
        pos_hint: {"center_x": .5, "center_y": .5}
        theme_bg_color: "Custom"
        md_bg_color: app.theme_cls.primaryColor
        on_release: app.theme_cls.switch_theme()
"""

class uiApp(MDApp):
  def build(self):
      self.theme_cls.dynamic_color = True
      self.theme_cls.path_to_wallpaper = '/some_image/Downloads/image.png'
      return Builder.load_string(KV)

uiApp().run()
HeaTTheatR commented 7 months ago

@T-Dynamos

https://github.com/kivymd/KivyMD/assets/16930280/7db73135-7ec5-4c63-bf1a-b34d50b8ace7

T-Dynamos commented 7 months ago

@HeaTTheatR With same image:

https://github.com/kivymd/KivyMD/assets/68729523/312ed574-d1d0-47ef-abc6-990c2c31f156

HeaTTheatR commented 7 months ago

Fix in master branch