From e83db8ce67f273c7d00232bac45cc2b10e6a2b46 Mon Sep 17 00:00:00 2001 From: phg Date: Tue, 29 Jul 2025 17:11:47 +0200 Subject: [PATCH] Enhance styling of active and inactive entries in DataTable for better visibility --- memory-bank/projectbrief.md | 1 + src/hosts/main.py | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/memory-bank/projectbrief.md b/memory-bank/projectbrief.md index d19e8bc..90fca46 100644 --- a/memory-bank/projectbrief.md +++ b/memory-bank/projectbrief.md @@ -9,6 +9,7 @@ The **hosts** project is a Python-based terminal application designed to manage The application provides a two-pane TUI: - **Left pane:** List of all hostname entries. With columns: +- - Active (add a ✓, when active) - IP address - Canonical hostname - **Right pane:** Detailed view of the selected entry. diff --git a/src/hosts/main.py b/src/hosts/main.py index 81b30dd..1515581 100644 --- a/src/hosts/main.py +++ b/src/hosts/main.py @@ -184,13 +184,13 @@ class HostsManagerApp(App): # Add row with styling based on active status if entry.is_active: # Active entries in green - ip_text = Text(entry.ip_address, style="green") - hostname_text = Text(canonical_hostname, style="green") + ip_text = Text(entry.ip_address, style="bold green") + hostname_text = Text(canonical_hostname, style="bold green") table.add_row(ip_text, hostname_text) else: - # Inactive entries in yellow/orange with # prefix and italic - ip_text = Text(f"# {entry.ip_address}", style="yellow italic") - hostname_text = Text(canonical_hostname, style="yellow italic") + # Inactive entries in dim yellow with italic (no # prefix in IP column) + ip_text = Text(entry.ip_address, style="dim yellow italic") + hostname_text = Text(canonical_hostname, style="dim yellow italic") table.add_row(ip_text, hostname_text) def restore_cursor_position(self, previous_entry) -> None: