From 9641629f358be1c67bee22cf4c64da179aedae48 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 9 Oct 2024 22:54:06 +0100 Subject: colorise article headlines, read -> green, unread -> red --- src/backend/getnews.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/backend') diff --git a/src/backend/getnews.py b/src/backend/getnews.py index cce7bcb..f222978 100644 --- a/src/backend/getnews.py +++ b/src/backend/getnews.py @@ -43,15 +43,15 @@ def mark_read(article_nr): if article_index in r_news_index: print( - f"\nArticle {sisyphus.getclr.green}{article_nr}{sisyphus.getclr.reset} is already marked as {sisyphus.getclr.green}read{sisyphus.getclr.reset}.") + f"\nArticle {sisyphus.getclr.bright_white}{article_nr}{sisyphus.getclr.reset} is already marked as {sisyphus.getclr.bright_green}read{sisyphus.getclr.reset}.") else: r_news_index.append(article_index) save_r_news(r_news_index) print( - f"\nArticle {sisyphus.getclr.green}{article_nr}{sisyphus.getclr.reset} marked as {sisyphus.getclr.green}read{sisyphus.getclr.reset}.") + f"\nArticle {sisyphus.getclr.bright_white}{article_nr}{sisyphus.getclr.reset} marked as {sisyphus.getclr.bright_green}read{sisyphus.getclr.reset}.") else: print( - f"\nArticle {sisyphus.getclr.green}{article_nr}{sisyphus.getclr.reset} doesn't exist.") + f"\nArticle {sisyphus.getclr.bright_white}{article_nr}{sisyphus.getclr.reset} doesn't exist.") def mark_unread(article_nr): @@ -63,15 +63,15 @@ def mark_unread(article_nr): if article_index not in r_news_index: print( - f"\nArticle {sisyphus.getclr.green}{article_nr}{sisyphus.getclr.reset} is already marked as {sisyphus.getclr.green}unread{sisyphus.getclr.reset}.") + f"\nArticle {sisyphus.getclr.bright_white}{article_nr}{sisyphus.getclr.reset} is already marked as {sisyphus.getclr.bright_red}unread{sisyphus.getclr.reset}.") else: r_news_index.remove(article_index) save_r_news(r_news_index) print( - f"\nArticle {sisyphus.getclr.green}{article_nr}{sisyphus.getclr.reset} marked as {sisyphus.getclr.green}unread{sisyphus.getclr.reset}.") + f"\nArticle {sisyphus.getclr.bright_white}{article_nr}{sisyphus.getclr.reset} marked as {sisyphus.getclr.bright_red}unread{sisyphus.getclr.reset}.") else: print( - f"\nArticle {sisyphus.getclr.green}{article_nr}{sisyphus.getclr.reset} doesn't exist.") + f"\nArticle {sisyphus.getclr.bright_white}{article_nr}{sisyphus.getclr.reset} doesn't exist.") def list_all_news(): @@ -79,9 +79,9 @@ def list_all_news(): r_news_index = ld_r_news() for index, news in enumerate(n_news): - status = "Read" if index in r_news_index else "Unread" + status = f"{sisyphus.getclr.bright_green}Read{sisyphus.getclr.reset}" if index in r_news_index else f"{sisyphus.getclr.bright_red}Unread{sisyphus.getclr.reset}" print( - f"\nArticle {sisyphus.getclr.green}{index + 1}{sisyphus.getclr.reset} ({status}):\n{news}") + f"\n{sisyphus.getclr.bright_yellow}Article {sisyphus.getclr.bright_white}{index + 1}{sisyphus.getclr.reset} ({status}):\n\n{news}") def start(list=False, read=False, unread=False, article_nr=None): @@ -91,11 +91,7 @@ def start(list=False, read=False, unread=False, article_nr=None): if read: if article_nr is not None: mark_read(article_nr) - else: - print("\nError: No article number provided to mark as read.") if unread: if article_nr is not None: mark_unread(article_nr) - else: - print("\nError: No article number provided to mark as unread.") -- cgit v1.2.3