From 299adb8e4d53549b148c771017490c0997e0c067 Mon Sep 17 00:00:00 2001 From: "Azalea (on HyDEV-Daisy)" Date: Sun, 19 Jun 2022 16:33:17 -0400 Subject: [PATCH] [O] Clear screen with title --- hyfetch/color_util.py | 5 ++++- hyfetch/main.py | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/hyfetch/color_util.py b/hyfetch/color_util.py index f7a1703c..c018db4b 100644 --- a/hyfetch/color_util.py +++ b/hyfetch/color_util.py @@ -49,12 +49,15 @@ def printc(msg: str): print(color(msg + '&r')) -def clear_screen(): +def clear_screen(title: str = ''): """ Clear screen using ANSI escape codes """ print('\033[2J\033[H', end='') + if title: + printc(title) + def redistribute_rgb(r: int, g: int, b: int) -> tuple[int, int, int]: """ diff --git a/hyfetch/main.py b/hyfetch/main.py index 725deaff..f6154f0c 100755 --- a/hyfetch/main.py +++ b/hyfetch/main.py @@ -103,8 +103,8 @@ def create_config() -> Config: :return: Config object (automatically stored) """ - clear_screen() - printc('\nWelcome to &b&lhy&f&lfetch&r! Let\'s set up some colors first.\n') + title = '\nWelcome to &b&lhy&f&lfetch&r! Let\'s set up some colors first.\n' + clear_screen(title) # Select color system try: @@ -129,7 +129,7 @@ def create_config() -> Config: color_system = literal_input('Which &acolor &bsystem &rdo you want to use?', ['8bit', 'rgb'], 'rgb') - clear_screen() + clear_screen(title) # Print preset print('Available presets:\n')