36 lines
1010 B
Python
36 lines
1010 B
Python
#--------------------------------------------------------------------
|
|
#
|
|
# PyGUI - Color utilities - Win32
|
|
#
|
|
#--------------------------------------------------------------------
|
|
|
|
import win32con as wc, win32api as api
|
|
from GUI import Color
|
|
|
|
def rgb(red, green, blue, alpha = 1.0, image = False, im = ''):
|
|
color = Color()
|
|
color.image = image
|
|
if image:
|
|
color.image = im._win_image
|
|
else:
|
|
color._red = red
|
|
color._green = green
|
|
color._blue = blue
|
|
color._alpha = alpha
|
|
color._win_color = (
|
|
int(red * 255) |
|
|
int(green * 255) << 8 |
|
|
int(blue * 255) << 16)
|
|
color._win_argb = (
|
|
int(blue * 255) |
|
|
int(green * 255) << 8 |
|
|
int(red * 255) << 16 |
|
|
int(alpha * 255) << 24)
|
|
return color
|
|
|
|
selection_forecolor = Color._from_win_color(
|
|
api.GetSysColor(wc.COLOR_HIGHLIGHTTEXT))
|
|
|
|
selection_backcolor = Color._from_win_color(
|
|
api.GetSysColor(wc.COLOR_HIGHLIGHT))
|