mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-28 10:23:49 +08:00
BigUI WIP: Accents
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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) ──
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user