test.py 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. from hyfetch.color_scale import test_color_scale
  2. from hyfetch.color_util import RGB, printc
  3. from hyfetch.neofetch_util import get_command_path, run_neofetch
  4. from hyfetch.presets import PRESETS
  5. def print_colors_test(colors: list[RGB]):
  6. print(''.join(f'{c.to_ansi_rgb()}#' for c in colors))
  7. def test_preset_length():
  8. p = PRESETS.get('transgender')
  9. print_colors_test(p.with_length(9))
  10. print_colors_test(p.with_length(6))
  11. p = PRESETS.get('nonbinary')
  12. print_colors_test(p.with_length(7))
  13. print_colors_test(p.with_length(6))
  14. def test_command_path():
  15. print(get_command_path())
  16. def test_rgb_8bit_conversion():
  17. for r in range(0, 255, 16):
  18. for g in range(0, 255, 16):
  19. print(RGB(r, g, 0).to_ansi_rgb(False), end=' ')
  20. printc('&r')
  21. print()
  22. for r in range(0, 255, 16):
  23. for g in range(0, 255, 16):
  24. print(RGB(r, g, 0).to_ansi_8bit(False), end=' ')
  25. printc('&r')
  26. print()
  27. if __name__ == '__main__':
  28. test_rgb_8bit_conversion()
  29. test_color_scale()