New in version 1.0.0.

Create, share, and apply color palettes to your UI, as well as measure the accessibility level of any color combination..


from typing import Union

from kivy.lang import Builder

from import MDApp
from kivymd.uix.pickers import MDColorPicker

KV = '''

        id: toolbar
        title: "MDTopAppBar"
        pos_hint: {"top": 1}

        text: "OPEN PICKER"
        pos_hint: {"center_x": .5, "center_y": .5}
        md_bg_color: toolbar.md_bg_color
        on_release: app.open_color_picker()

class MyApp(MDApp):
    def build(self):
        return Builder.load_string(KV)

    def open_color_picker(self):
        color_picker = MDColorPicker(size_hint=(0.45, 0.85))

    def update_color(self, color: list) -> None:
        self.root.ids.toolbar.md_bg_color = color

    def get_selected_color(
        instance_color_picker: MDColorPicker,
        type_color: str,
        selected_color: Union[list, str],
        '''Return selected color.'''

        print(f"Selected color is {selected_color}")
        self.update_color(selected_color[:-1] + [1])

    def on_select_color(self, instance_gradient_tab, color: list) -> None:
        '''Called when a gradient image is clicked.'''


API - kivymd.uix.pickers.colorpicker.colorpicker#

class kivymd.uix.pickers.colorpicker.colorpicker.MDColorPicker(**kwargs)#

Base class for dialog movement behavior.

For more information, see in the MotionBase class documentation.


A list of values that are used to create the gradient. These values are selected empirically. Each of these values will be added to the selected RGB value, thus creating colors that are close in value.

adjacent_color_constants is an ListProperty and defaults to [0.299, 0.887, 0.411].


Default color value in (r, g, b, a) or string format. The set color value will be used when you open the dialog.

default_color is an ColorProperty and defaults to None.


Type of color. Available options are: ‘RGBA’, ‘HEX’, ‘RGB’.

type_color is an OptionProperty and defaults to ‘RGB’.


Button background for choosing a color type (‘RGBA’, ‘HEX’, ‘HSL’, ‘RGB’) in (r, g, b, a) or string format.

background_down_button_selected_type_color is an ColorProperty and defaults to [1, 1, 1, 0.3].


The radius value for the color scale.

radius is an VariableListProperty and defaults to [8, 8, 8, 8].


Color selection button text.

text_button_ok is an StringProperty and defaults to ‘SELECT’.


Cancel button text.

text_button_cancel is an StringProperty and defaults to ‘CANCEL’.

update_color_slider_item_bottom_navigation(self, color: list)#

Updates the color of the slider that sets the transparency value of the selected color and the color of bottom navigation items.

update_color_type_buttons(self, color: list)#

Updating button colors (display buttons of type of color) to match the selected color.

get_rgb(self, color: list)#

Returns an RGB list of values from 0 to 255.

on_background_down_button_selected_type_color(self, instance_color_picker, color: list)#
on_type_color(self, instance_color_picker, type_color: str = '', interval: float | int = 0)#

Called when buttons are clicked to set the color type.


Default open event handler.

on_select_color(self, color: list)#

Called when a gradient image is clicked.

on_switch_tabs(self, bottom_navigation_instance, bottom_navigation_item_instance, name_tab)#

Called when switching tabs of bottom navigation.

on_release(self, *args)#

Called when the SELECT button is pressed