forked from nlfmt/pyqt-colorpicker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.py
36 lines (23 loc) · 835 Bytes
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from swcolorpicker import getColor, useAlpha
old_color = (255, 255, 255)
picked_color = getColor(old_color)
print(picked_color)
useAlpha(True)
old_color = (255, 230, 255, 50)
picked_color = getColor(old_color)
print(picked_color)
# Using the old way of creating a ColorPicker:
from swcolorpicker import ColorPicker, hsv2rgb, rgb2hsv
my_color_picker = ColorPicker(useAlpha=True)
my_color_picker_light = ColorPicker()
old_color = (255, 255, 255, 50)
picked_color = my_color_picker.getColor(old_color)
print(picked_color)
old_color = (255,0,255)
picked_color = my_color_picker_light.getColor(old_color)
print(picked_color)
# Don't have your color in RGB format?
my_color = (50, 50, 100, 60) # HSV Color in percent
old_color = hsv2rgb(my_color)
picked_color = rgb2hsv(my_color_picker.getColor(old_color))
print(picked_color)