pygame color picker code example

Example: pygame color picker

from hooman import Hooman
import pygame

window_width, window_height = 500, 500
hapi = Hooman(window_width, window_height)


slider_options = {"value_range": [0, 255]}

r_slider = hapi.slider(50, 300, 400, 10, slider_options)
g_slider = hapi.slider(50, 330, 400, 10, slider_options)
b_slider = hapi.slider(50, 360, 400, 10, slider_options)

while hapi.is_running:
    bg_col = (r_slider.value(), g_slider.value(), b_slider.value())
    hapi.background(bg_col)

    r_slider.update()
    g_slider.update()
    b_slider.update()

    hapi.fill(hapi.color["black"])
    r_text = "r:{}".format(r_slider.value())
    hapi.text(r_text, 50, 280)
    g_text = "g:{}".format(g_slider.value())
    hapi.text(g_text, 50, 310)
    b_text = "b:{}".format(b_slider.value())
    hapi.text(b_text, 50, 340)

    hapi.flip_display()
    hapi.event_loop()

pygame.quit()