Improve hourly forecast: Larger icons, smaller text, better spacing

This commit is contained in:
ChuckBuilds
2025-04-11 14:05:18 -05:00
parent f8f4f51d94
commit ee34d33c7d

View File

@@ -39,7 +39,7 @@ class WeatherManager:
self.PADDING = 1 self.PADDING = 1
self.ICON_SIZE = { self.ICON_SIZE = {
'large': 10, 'large': 10,
'medium': 8, 'medium': 14, # Increased for hourly forecast icons
'small': 6 'small': 6
} }
self.COLORS = { self.COLORS = {
@@ -48,7 +48,8 @@ class WeatherManager:
'separator': (64, 64, 64), 'separator': (64, 64, 64),
'temp_high': (255, 100, 100), 'temp_high': (255, 100, 100),
'temp_low': (100, 100, 255), 'temp_low': (100, 100, 255),
'dim': (180, 180, 180) 'dim': (180, 180, 180),
'extra_dim': (120, 120, 120) # Even dimmer for smallest text
} }
# Add caching for last drawn states # Add caching for last drawn states
self.last_weather_state = None self.last_weather_state = None
@@ -334,16 +335,18 @@ class WeatherManager:
x = i * section_width x = i * section_width
center_x = x + section_width // 2 center_x = x + section_width // 2
# Draw hour at top # Draw hour at top - using extra small font
hour_text = forecast['hour'] hour_text = forecast['hour']
# Simplify time format
hour_text = hour_text.replace(":00 ", "").replace("PM", "p").replace("AM", "a")
hour_width = draw.textlength(hour_text, font=self.display_manager.small_font) hour_width = draw.textlength(hour_text, font=self.display_manager.small_font)
draw.text((center_x - hour_width // 2, 2), draw.text((center_x - hour_width // 2, 1), # Moved up slightly
hour_text, hour_text,
font=self.display_manager.small_font, font=self.display_manager.small_font,
fill=self.COLORS['text']) fill=self.COLORS['extra_dim']) # Using extra dim color
# Draw weather icon in middle # Draw weather icon in middle - made larger and centered
icon_y = 12 icon_y = 8 # Adjusted to be more centered
self.display_manager.draw_weather_icon( self.display_manager.draw_weather_icon(
forecast['condition'], forecast['condition'],
x=center_x - self.ICON_SIZE['medium'] // 2, x=center_x - self.ICON_SIZE['medium'] // 2,
@@ -351,13 +354,13 @@ class WeatherManager:
size=self.ICON_SIZE['medium'] size=self.ICON_SIZE['medium']
) )
# Draw temperature at bottom # Draw temperature at bottom - using extra small font
temp_text = f"{forecast['temp']}°" temp_text = f"{forecast['temp']}°"
temp_width = draw.textlength(temp_text, font=self.display_manager.small_font) temp_width = draw.textlength(temp_text, font=self.display_manager.small_font)
draw.text((center_x - temp_width // 2, 24), draw.text((center_x - temp_width // 2, 25), # Moved down slightly
temp_text, temp_text,
font=self.display_manager.small_font, font=self.display_manager.small_font,
fill=self.COLORS['highlight']) fill=self.COLORS['extra_dim']) # Using extra dim color
# Update the display # Update the display
self.display_manager.image = image self.display_manager.image = image