-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwhatColorYouNeed.py
46 lines (33 loc) · 986 Bytes
/
whatColorYouNeed.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
37
38
39
40
41
42
43
44
45
46
import gspread
import gspread_formatting as gf
from gspread_formatting import *
from config import *
def whatColorYouNeed(row, worksheet, UserWarnBan='None'):
if UserWarnBan == 'User':
pass
else:
if UserWarnBan == 'None':
#print(f"UWB - {UserWarnBan}")
rgb = (255, 255, 255)
return rgb
else:
#print(f"UWB2 - {UserWarnBan}")
rgb = (255, 255, 255)
return rgb
if UserWarnBan == 'User':
text = 'B' + str(row)
gfs2 = gf.get_user_entered_format(worksheet, text)
try:
red = gfs2.backgroundColor.red * 100
green = gfs2.backgroundColor.green * 100
blue = gfs2.backgroundColor.blue * 100
except:
red = 100
green = 100
blue = 100
red = int(red)
green = int(green)
blue = int(blue)
rgb = (f'{red}', f'{green}',f'{blue}')
rgb = tuple(int(int(s) * 2.55) for s in rgb)
return rgb