constants.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. from __future__ import annotations
  2. import os
  3. from dataclasses import dataclass
  4. from pathlib import Path
  5. from typing_extensions import Literal
  6. CONFIG_PATH = Path.home() / '.config/hyfetch.json'
  7. VERSION = '1.4.4rc1'
  8. TEST_ASCII = r"""
  9. ### |\___/| ###
  10. ### ) ( ###
  11. ## =\ /= ##
  12. #### )===( ####
  13. ### / \ ###
  14. ### | | ###
  15. ## / {txt} \ ##
  16. ## \ / ##
  17. _/\_\_ _/_/\_
  18. |##| ( ( |##|
  19. |##| ) ) |##|
  20. |##| (_( |##|""".strip('\n')
  21. TEST_ASCII_WIDTH = max(len(line) for line in TEST_ASCII.split('\n'))
  22. DEFAULT_DARK_L = 0.
  23. @dataclass
  24. class GlobalConfig:
  25. # Global color mode default to 8-bit for compatibility
  26. color_mode: str
  27. override_distro: str | None
  28. debug: bool
  29. is_light: bool
  30. def light_dark(self) -> Literal['light', 'dark']:
  31. return 'light' if self.is_light else 'dark'
  32. def default_lightness(self, term: Literal['light', 'dark'] | None = None) -> float:
  33. if term is None:
  34. term = self.light_dark()
  35. return 0.65 if term.lower() == 'dark' else 0.4
  36. GLOBAL_CFG = GlobalConfig(color_mode='8bit', override_distro=None, debug=False, is_light=False)
  37. MINGIT_URL = 'https://github.com/git-for-windows/git/releases/download/v2.37.2.windows.2/MinGit-2.37.2.2-busybox-32-bit.zip'