This commit is contained in:
Michał Gdula 2023-08-04 17:34:08 +00:00
parent 4c7bf9706f
commit d19a33501a
36 changed files with 808 additions and 1052 deletions

View file

@ -3,7 +3,7 @@ OnlyLegs filters
Custom Jinja2 filters
"""
from flask import Blueprint
from onlylegs.utils.colour import contrast
from onlylegs.utils import colour as colour_utils
blueprint = Blueprint("filters", __name__)
@ -16,7 +16,5 @@ def colour_contrast(colour):
a css variable based on the contrast of text required to be readable
"color: var(--fg-white);" or "color: var(--fg-black);"
"""
bright = "var(--fg-white)"
dark = "var(--fg-black)"
return "color: RGB(" + contrast(colour, dark, bright) + ");"
colour_obj = colour_utils.Colour(colour)
return "rgb(var(--fg-black));" if colour_obj.is_light() else "rgb(var(--fg-white));"