hyfetch/tools/colors_test.py

40 lines
1 KiB
Python
Raw Normal View History

2022-06-19 13:33:16 -06:00
from hyfetch.color_scale import test_color_scale
2022-04-25 12:05:20 -06:00
from hyfetch.color_util import RGB, printc
2022-04-10 20:43:34 -06:00
from hyfetch.neofetch_util import get_command_path, run_neofetch
2022-04-10 01:30:00 -06:00
from hyfetch.presets import PRESETS
def print_colors_test(colors: list[RGB]):
print(''.join(f'{c.to_ansi_rgb()}#' for c in colors))
2022-04-10 20:43:34 -06:00
def test_preset_length():
2022-04-10 01:30:00 -06:00
p = PRESETS.get('transgender')
print_colors_test(p.with_length(9))
print_colors_test(p.with_length(6))
p = PRESETS.get('nonbinary')
print_colors_test(p.with_length(7))
print_colors_test(p.with_length(6))
2022-04-10 20:43:34 -06:00
def test_command_path():
print(get_command_path())
def test_rgb_8bit_conversion():
for r in range(0, 255, 16):
for g in range(0, 255, 16):
print(RGB(r, g, 0).to_ansi_rgb(False), end=' ')
printc('&r')
print()
for r in range(0, 255, 16):
for g in range(0, 255, 16):
print(RGB(r, g, 0).to_ansi_8bit(False), end=' ')
printc('&r')
print()
if __name__ == '__main__':
test_rgb_8bit_conversion()
2022-06-19 13:33:16 -06:00
test_color_scale()