In this video I’ll show you how to select and use Color Themes with KivyMD.
With KivyMD, you don’t so much choose colors for your app and widgets, instead you choose a broad color theme made up of one strong color, and KivyMD applies that theme to all of your widgets itself.
You have some latitude in changing the lightness and darkness of certain things, but that’s really all. This is in keeping with the precepts of Google’s Material Design (MD).
Python Code: color_theme.py
GitHub Code: color_theme.py
from kivy.lang import Builder from kivymd.app import MDApp #‘Red’, ‘Pink’, ‘Purple’, ‘DeepPurple’, #‘Indigo’, ‘Blue’, ‘LightBlue’, ‘Cyan’, #‘Teal’, ‘Green’, ‘LightGreen’, ‘Lime’, #‘Yellow’, ‘Amber’, ‘Orange’, ‘DeepOrange’, #‘Brown’, ‘Gray’, ‘BlueGray’. class MainApp(MDApp): def build(self): self.theme_cls.theme_style = "Dark" self.theme_cls.primary_palette = "Indigo" self.theme_cls.accent_palette = "Red" return Builder.load_file('color_theme.kv') MainApp().run()
Kivy Design Code: color_theme.kv
GitHub Code: color_theme.kv
Screen: MDRectangleFlatButton: text: "Light Button" pos_hint: {"center_x": 0.5, "center_y": 0.7} md_bg_color: app.theme_cls.primary_light MDRaisedButton: text: "Primary Button" pos_hint: {"center_x": 0.5, "center_y": 0.5} MDRaisedButton: text: "Dark Button" pos_hint: {"center_x": 0.5, "center_y": 0.3} md_bg_color: app.theme_cls.primary_dark
Nice ! I almost cleared the kivy basics with your videos
Awesome!