Enhance styling of active and inactive entries in DataTable for better visibility
This commit is contained in:
		
							parent
							
								
									9cd2b5c3fe
								
							
						
					
					
						commit
						e83db8ce67
					
				
					 2 changed files with 6 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -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.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue