marquesafonso commited on
Commit
d6e9825
·
1 Parent(s): 1f7b6ee

fix rgba to percentage

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -11,7 +11,7 @@ def check_rgba(string:str):
11
  return string
12
  else:
13
  clean_str_list = string.split("(")[1].split(")")[0].split(",")
14
- clean_list = [float(i.strip()) for i in clean_str_list]
15
  print(clean_list)
16
  hex = to_hex(clean_list, keep_alpha=True)
17
  print(hex)
 
11
  return string
12
  else:
13
  clean_str_list = string.split("(")[1].split(")")[0].split(",")
14
+ clean_list = [float(value.strip()) / 255 if idx != 3 else float(value.strip()) / 1 for idx, value in enumerate(clean_str_list)]
15
  print(clean_list)
16
  hex = to_hex(clean_list, keep_alpha=True)
17
  print(hex)