mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-06-29 11:36:16 +00:00
Format code with Black
This commit is contained in:
parent
fef8a557d2
commit
128464d43f
18 changed files with 697 additions and 604 deletions
|
@ -16,7 +16,10 @@ def contrast(background, light, dark, threshold=0.179):
|
|||
|
||||
# Calculate contrast
|
||||
uicolors = [red / 255, green / 255, blue / 255]
|
||||
cont = [col / 12.92 if col <= 0.03928 else ((col + 0.055) / 1.055) ** 2.4 for col in uicolors]
|
||||
cont = [
|
||||
col / 12.92 if col <= 0.03928 else ((col + 0.055) / 1.055) ** 2.4
|
||||
for col in uicolors
|
||||
]
|
||||
lightness = (0.2126 * cont[0]) + (0.7152 * cont[1]) + (0.0722 * cont[2])
|
||||
|
||||
return light if lightness > threshold else dark
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue