diff --git a/selfdrive/ui/layouts/settings/starpilot/aethergrid.py b/selfdrive/ui/layouts/settings/starpilot/aethergrid.py index 5a6816fb56..645397df78 100644 --- a/selfdrive/ui/layouts/settings/starpilot/aethergrid.py +++ b/selfdrive/ui/layouts/settings/starpilot/aethergrid.py @@ -1,5 +1,5 @@ from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, replace import math import time import pyray as rl @@ -280,6 +280,19 @@ DEFAULT_PANEL_STYLE = PanelStyle( ) +def panel_style_from_color(hex_color: str, base: PanelStyle | None = None) -> PanelStyle: + color = hex_to_color(hex_color) + if base is None: + base = DEFAULT_PANEL_STYLE + return replace( + base, + accent=color, + current_fill=rl.Color(color.r, color.g, color.b, 16), + current_border=rl.Color(color.r, color.g, color.b, 42), + underline_color=rl.Color(color.r, color.g, color.b, 150), + ) + + def _inflate_rect(rect: rl.Rectangle, pad_x: float = 10, pad_y: float = 6) -> rl.Rectangle: return rl.Rectangle(rect.x - pad_x, rect.y - pad_y, rect.width + pad_x * 2, rect.height + pad_y * 2) diff --git a/selfdrive/ui/layouts/settings/starpilot/appearance.py b/selfdrive/ui/layouts/settings/starpilot/appearance.py index ac3f280338..8c05411bdd 100644 --- a/selfdrive/ui/layouts/settings/starpilot/appearance.py +++ b/selfdrive/ui/layouts/settings/starpilot/appearance.py @@ -13,7 +13,7 @@ from openpilot.selfdrive.ui.lib.starpilot_state import starpilot_state from openpilot.selfdrive.ui.layouts.settings.starpilot.panel import _SettingsPage from openpilot.selfdrive.ui.layouts.settings.starpilot.aethergrid import ( AetherSliderDialog, - DEFAULT_PANEL_STYLE, + panel_style_from_color, ) from openpilot.selfdrive.ui.layouts.settings.starpilot.longitudinal import ( SettingRow, @@ -21,7 +21,7 @@ from openpilot.selfdrive.ui.layouts.settings.starpilot.longitudinal import ( AetherSettingsView, ) -PANEL_STYLE = DEFAULT_PANEL_STYLE +PANEL_STYLE = panel_style_from_color("#8B5CF6") # ── Theme paths & config (preserved from themes.py) ── diff --git a/selfdrive/ui/layouts/settings/starpilot/driving_model.py b/selfdrive/ui/layouts/settings/starpilot/driving_model.py index 6cb623d75b..d7e7296ef1 100644 --- a/selfdrive/ui/layouts/settings/starpilot/driving_model.py +++ b/selfdrive/ui/layouts/settings/starpilot/driving_model.py @@ -37,7 +37,7 @@ from openpilot.selfdrive.ui.layouts.settings.starpilot.aethergrid import ( AetherChip, AetherListColors, AetherScrollbar, - DEFAULT_PANEL_STYLE, + panel_style_from_color, _point_hits, draw_action_rail, draw_action_pill, @@ -72,7 +72,7 @@ BUTTON_HEIGHT = AETHER_LIST_METRICS.header_button_height FADE_HEIGHT = AETHER_LIST_METRICS.fade_height CONFIRM_TIMEOUT_SECONDS = 3.0 TRANSITION_SECONDS = 0.24 -PANEL_STYLE = DEFAULT_PANEL_STYLE +PANEL_STYLE = panel_style_from_color("#3B82F6") @dataclass diff --git a/selfdrive/ui/layouts/settings/starpilot/lateral.py b/selfdrive/ui/layouts/settings/starpilot/lateral.py index cbfa4af7ab..a1175e7249 100644 --- a/selfdrive/ui/layouts/settings/starpilot/lateral.py +++ b/selfdrive/ui/layouts/settings/starpilot/lateral.py @@ -14,11 +14,11 @@ from openpilot.selfdrive.ui.layouts.settings.starpilot.longitudinal import ( from openpilot.selfdrive.ui.layouts.settings.starpilot.aethergrid import ( AETHER_LIST_METRICS, AetherSliderDialog, - DEFAULT_PANEL_STYLE, + panel_style_from_color, ) -PANEL_STYLE = DEFAULT_PANEL_STYLE +PANEL_STYLE = panel_style_from_color("#3B82F6") def _confirm_reboot_toggle(params, key, state): diff --git a/selfdrive/ui/layouts/settings/starpilot/longitudinal.py b/selfdrive/ui/layouts/settings/starpilot/longitudinal.py index 10852c902c..fc62162916 100644 --- a/selfdrive/ui/layouts/settings/starpilot/longitudinal.py +++ b/selfdrive/ui/layouts/settings/starpilot/longitudinal.py @@ -21,7 +21,7 @@ from openpilot.selfdrive.ui.layouts.settings.starpilot.aethergrid import ( AetherListColors, AetherScrollbar, AetherSliderDialog, - DEFAULT_PANEL_STYLE, + panel_style_from_color, _point_hits, draw_list_group_shell, draw_list_scroll_fades, @@ -42,7 +42,7 @@ from openpilot.starpilot.common.accel_profile import ( from openpilot.starpilot.common.experimental_state import sync_persist_experimental_state -PANEL_STYLE = DEFAULT_PANEL_STYLE +PANEL_STYLE = panel_style_from_color("#3B82F6") SECTION_GAP = AETHER_LIST_METRICS.section_gap SECTION_HEADER_HEIGHT = AETHER_LIST_METRICS.section_header_height SECTION_HEADER_GAP = AETHER_LIST_METRICS.section_header_gap diff --git a/selfdrive/ui/layouts/settings/starpilot/maps.py b/selfdrive/ui/layouts/settings/starpilot/maps.py index 13d7105fd0..1de0b39b79 100644 --- a/selfdrive/ui/layouts/settings/starpilot/maps.py +++ b/selfdrive/ui/layouts/settings/starpilot/maps.py @@ -25,7 +25,7 @@ from openpilot.selfdrive.ui.layouts.settings.starpilot.aethergrid import ( AetherButton, AetherListColors, AetherScrollbar, - DEFAULT_PANEL_STYLE, + panel_style_from_color, build_list_panel_frame, draw_action_pill, draw_busy_ring, @@ -85,13 +85,7 @@ STATUS_REMOVE_HEIGHT = 40 STATUS_METRIC_GAP = 18 STATUS_SELECTION_CHIP_HEIGHT = 30 MAPS_TILE_GREEN = rl.Color(16, 185, 129, 255) -PANEL_STYLE = replace( - DEFAULT_PANEL_STYLE, - accent=MAPS_TILE_GREEN, - current_fill=rl.Color(16, 185, 129, 16), - current_border=rl.Color(16, 185, 129, 42), - underline_color=rl.Color(16, 185, 129, 150), -) +PANEL_STYLE = panel_style_from_color("#10B981") MAPS_METRICS = replace(AETHER_LIST_METRICS, header_height=240) COUNTRIES_SECTION = next(section for section in MAPS_CATALOG if section["key"] == "countries") diff --git a/selfdrive/ui/layouts/settings/starpilot/sounds.py b/selfdrive/ui/layouts/settings/starpilot/sounds.py index 1bb62b63c5..fb16d9329b 100644 --- a/selfdrive/ui/layouts/settings/starpilot/sounds.py +++ b/selfdrive/ui/layouts/settings/starpilot/sounds.py @@ -16,14 +16,14 @@ from openpilot.selfdrive.ui.layouts.settings.starpilot.aethergrid import ( AETHER_LIST_METRICS, AetherAdjustorRow, AetherListColors, - DEFAULT_PANEL_STYLE, + panel_style_from_color, _point_hits, draw_settings_panel_header, draw_toggle_pill, init_list_panel, ) -PANEL_STYLE = DEFAULT_PANEL_STYLE +PANEL_STYLE = panel_style_from_color("#E63956") SECTION_GAP = AETHER_LIST_METRICS.section_gap diff --git a/selfdrive/ui/layouts/settings/starpilot/system_settings.py b/selfdrive/ui/layouts/settings/starpilot/system_settings.py index a6a71c74cd..7f5a2e0d7b 100644 --- a/selfdrive/ui/layouts/settings/starpilot/system_settings.py +++ b/selfdrive/ui/layouts/settings/starpilot/system_settings.py @@ -29,7 +29,7 @@ from openpilot.selfdrive.ui.layouts.settings.starpilot.aethergrid import ( AetherScrollbar, AetherSegmentedControl, AetherListColors, - DEFAULT_PANEL_STYLE, + panel_style_from_color, _point_hits, init_list_panel, draw_list_group_shell, @@ -82,7 +82,7 @@ SECTION_HEADER_HEIGHT = AETHER_LIST_METRICS.section_header_height SECTION_HEADER_GAP = AETHER_LIST_METRICS.section_header_gap ROW_HEIGHT = AETHER_LIST_METRICS.row_height FADE_HEIGHT = AETHER_LIST_METRICS.fade_height -PANEL_STYLE = DEFAULT_PANEL_STYLE +PANEL_STYLE = panel_style_from_color("#D946EF") class SystemSettingsManagerView(Widget): diff --git a/selfdrive/ui/layouts/settings/starpilot/vehicle.py b/selfdrive/ui/layouts/settings/starpilot/vehicle.py index 32d1354af2..9e1d4e29bf 100644 --- a/selfdrive/ui/layouts/settings/starpilot/vehicle.py +++ b/selfdrive/ui/layouts/settings/starpilot/vehicle.py @@ -16,7 +16,7 @@ from openpilot.selfdrive.ui.layouts.settings.starpilot.aethergrid import ( AetherListColors, AetherScrollbar, AetherSliderDialog, - DEFAULT_PANEL_STYLE, + panel_style_from_color, _point_hits, draw_list_group_shell, draw_list_scroll_fades, @@ -66,7 +66,7 @@ SECTION_HEADER_HEIGHT = AETHER_LIST_METRICS.section_header_height SECTION_HEADER_GAP = AETHER_LIST_METRICS.section_header_gap ROW_HEIGHT = AETHER_LIST_METRICS.row_height FADE_HEIGHT = AETHER_LIST_METRICS.fade_height -PANEL_STYLE = DEFAULT_PANEL_STYLE +PANEL_STYLE = panel_style_from_color("#64748B") class VehicleSettingsManagerView(Widget):