[M] Move literal types to types.py

This commit is contained in:
Hykilpikonna 2022-12-10 21:00:10 -05:00
parent 4d073df750
commit f786dce40e
No known key found for this signature in database
GPG key ID: 256CD01A41D7FA26
6 changed files with 22 additions and 21 deletions

View file

@ -1,10 +1,9 @@
from __future__ import annotations
import os
from dataclasses import dataclass
from pathlib import Path
from typing_extensions import Literal
from .types import LightDark
CONFIG_PATH = Path.home() / '.config/hyfetch.json'
VERSION = '1.4.4'
@ -36,10 +35,10 @@ class GlobalConfig:
debug: bool
is_light: bool
def light_dark(self) -> Literal['light', 'dark']:
def light_dark(self) -> LightDark:
return 'light' if self.is_light else 'dark'
def default_lightness(self, term: Literal['light', 'dark'] | None = None) -> float:
def default_lightness(self, term: LightDark | None = None) -> float:
if term is None:
term = self.light_dark()
return 0.65 if term.lower() == 'dark' else 0.4