[F] Fix light dark detection

This commit is contained in:
Azalea (on HyDEV-Daisy) 2022-10-19 23:48:41 -04:00
parent 220b528c72
commit 09185e5a41
No known key found for this signature in database
GPG key ID: E289FAC0DA92DD2B
2 changed files with 3 additions and 1 deletions

View file

@ -298,5 +298,6 @@ def get_fore_back(distro: str | None = None) -> tuple[int, int] | None:
fore_back = {
'fedora': (2, 1),
'ubuntu': (2, 1),
'kubuntu': (2, 1),
}

View file

@ -112,7 +112,7 @@ class ColorProfile:
"""
return ColorProfile([c.set_light(light, at_least, at_most) for c in self.colors])
def set_light_dl(self, light: float, term: LightDark = GLOBAL_CFG.light_dark()):
def set_light_dl(self, light: float, term: LightDark | None = None):
"""
Set HSL lightness value with respect to dark/light terminals
@ -120,6 +120,7 @@ class ColorProfile:
:param term: Terminal color (can be "dark" or "light")
:return: New color profile (original isn't modified)
"""
term = term or GLOBAL_CFG.light_dark()
assert term.lower() in ['light', 'dark']
at_least, at_most = (True, None) if term.lower() == 'dark' else (None, True)
return self.set_light_raw(light, at_least, at_most)