BigUI WIP: Accents

This commit is contained in:
firestarsdog
2026-05-11 02:17:28 -04:00
parent 7b557144b3
commit a5dedeb164
9 changed files with 22 additions and 22 deletions
@@ -3115,10 +3115,10 @@ class TileGrid(Widget):
tile_idx += 1
def draw_toggle_pill(rect: rl.Rectangle, is_on: bool, is_enabled: bool, title: str, status_str: str, hovered: bool, pressed: bool):
def draw_toggle_pill(rect: rl.Rectangle, is_on: bool, is_enabled: bool, title: str, status_str: str, hovered: bool, pressed: bool, style: PanelStyle = DEFAULT_PANEL_STYLE):
rect = _snap_rect(rect)
bg_color = rl.Color(28, 32, 40, 170 if not is_enabled else 255)
accent = AetherListColors.PRIMARY if is_on and is_enabled else rl.Color(255, 255, 255, 52 if is_enabled else 20)
accent = style.accent if is_on and is_enabled else rl.Color(255, 255, 255, 52 if is_enabled else 20)
_draw_rounded_fill(rect, bg_color, radius_px=18)
_draw_rounded_stroke(rect, _with_alpha(accent, 92 if is_on and is_enabled else accent.a), radius_px=18)
@@ -3127,7 +3127,7 @@ def draw_toggle_pill(rect: rl.Rectangle, is_on: bool, is_enabled: bool, title: s
_draw_rounded_fill(rect, overlay, radius_px=18)
if is_on and is_enabled:
rl.draw_rectangle_rec(rl.Rectangle(rect.x, rect.y, 1, rect.height), _with_alpha(AetherListColors.PRIMARY, 160))
rl.draw_rectangle_rec(rl.Rectangle(rect.x, rect.y, 1, rect.height), _with_alpha(style.accent, 160))
font = gui_app.font(FontWeight.BOLD)
title_size = max(16, min(22, int(rect.height * 0.26)))
@@ -542,7 +542,7 @@ class StarPilotAppearanceLayout(_SettingsPage):
if res == DialogResult.CONFIRM:
self._params.put_int(key, int(val))
gui_app.push_widget(AetherSliderDialog(tr(key), min_v, max_v, 1, self._params.get_int(key), on_close,
unit=unit, color="#8B5CF6"))
unit=unit, color=PANEL_STYLE.accent))
def _show_float_selector(self, key, min_v, max_v, step, unit="", convert=None, unconvert=None):
current = self._params.get_float(key)
@@ -557,7 +557,7 @@ class StarPilotAppearanceLayout(_SettingsPage):
self._params.put_float(key, v)
gui_app.push_widget(AetherSliderDialog(tr(key), min_v, max_v, step, current, on_close,
unit=unit, color="#8B5CF6"))
unit=unit, color=PANEL_STYLE.accent))
# ── Unit-aware display helpers ──
@@ -499,7 +499,7 @@ class DrivingModelManagerView(Widget):
def _draw_downloading_action(self, rect: rl.Rectangle, progress_text: str):
center = rl.Vector2(rect.x + rect.width / 2, rect.y + rect.height / 2 - 8)
phase = (time.monotonic() * 240.0) % 360.0
draw_busy_ring(center, phase, AetherListColors.PRIMARY)
draw_busy_ring(center, phase, PANEL_STYLE.accent)
label = progress_text if progress_text else tr("Downloading")
gui_label(
@@ -543,15 +543,15 @@ class DrivingModelManagerView(Widget):
# Favorite toggle button
is_fav = entry.user_favorite
fav_fill = rl.Color(210, 100, 130, 44) if is_fav else AetherListColors.PRIMARY_SOFT
fav_border = rl.Color((210 if is_fav else AetherListColors.PRIMARY.r), (100 if is_fav else AetherListColors.PRIMARY.g), (130 if is_fav else AetherListColors.PRIMARY.b), min((255 if is_fav else AetherListColors.PRIMARY.a), 70))
fav_text_color = rl.Color(210, 100, 130, 255) if is_fav else AetherListColors.PRIMARY
fav_fill = rl.Color(210, 100, 130, 44) if is_fav else rl.Color(PANEL_STYLE.accent.r, PANEL_STYLE.accent.g, PANEL_STYLE.accent.b, 26)
fav_border = rl.Color((210 if is_fav else PANEL_STYLE.accent.r), (100 if is_fav else PANEL_STYLE.accent.g), (130 if is_fav else PANEL_STYLE.accent.b), min((255 if is_fav else PANEL_STYLE.accent.a), 70))
fav_text_color = rl.Color(210, 100, 130, 255) if is_fav else PANEL_STYLE.accent
fav_label = tr("Unfavorite") if is_fav else tr("Favorite")
draw_action_pill(fav_rect, fav_label, fav_fill, fav_border, fav_text_color)
def _draw_current_action(self, rect: rl.Rectangle):
chip_rect = rl.Rectangle(rect.x + 24, rect.y + (rect.height - 42) / 2, rect.width - 48, 42)
AetherChip(tr("Current"), rl.Color(89, 116, 151, 26), rl.Color(116, 136, 168, 52), AetherListColors.HEADER, font_size=18).render(chip_rect)
AetherChip(tr("Current"), PANEL_STYLE.current_fill, PANEL_STYLE.current_border, AetherListColors.HEADER, font_size=18).render(chip_rect)
def _draw_protected_action(self, rect: rl.Rectangle):
chip_rect = rl.Rectangle(rect.x + 20, rect.y + (rect.height - 42) / 2, rect.width - 40, 42)
@@ -1137,10 +1137,10 @@ class StarPilotDrivingModelLayout(_SettingsPage):
self._update_model_metadata()
def _on_recovery_power_clicked(self):
self._show_slider("RecoveryPower", 0.5, 2.0, step=0.1, unit="x", value_type="float", title="Recovery Power")
self._show_slider("RecoveryPower", 0.5, 2.0, step=0.1, unit="x", value_type="float", title="Recovery Power", color=PANEL_STYLE.accent)
def _on_stop_distance_clicked(self):
self._show_slider("StopDistance", 4.0, 10.0, step=0.1, unit="m", value_type="float", title="Stop Distance")
self._show_slider("StopDistance", 4.0, 10.0, step=0.1, unit="m", value_type="float", title="Stop Distance", color=PANEL_STYLE.accent)
def _on_blacklist_clicked(self):
blacklisted = [m.strip() for m in (self._params.get("BlacklistedModels", encoding="utf-8") or "").split(",") if m.strip()]
@@ -257,4 +257,4 @@ class StarPilotLateralLayout(_SettingsPage):
if res == DialogResult.CONFIRM:
self._params.put_int("LaneChangeSmoothing", int(val))
current = self._params.get_int("LaneChangeSmoothing") if self._params.get_int("LaneChangeSmoothing") > 0 else 10
gui_app.set_modal_overlay(AetherSliderDialog(tr("Lane Change Smoothing"), 1, 10, 1, current, on_close, color="#597497"))
gui_app.set_modal_overlay(AetherSliderDialog(tr("Lane Change Smoothing"), 1, 10, 1, current, on_close, color=PANEL_STYLE.accent))
@@ -275,7 +275,7 @@ class MapStatusCard(Widget):
if self._controller._download_state.active:
center = rl.Vector2(primary_rect.x + primary_rect.width - 22, primary_rect.y + primary_rect.height / 2)
draw_busy_ring(center, rl.get_time() * 160, AetherListColors.PRIMARY, inner_radius=9, outer_radius=13, sweep=210, thickness=20)
draw_busy_ring(center, rl.get_time() * 160, PANEL_STYLE.accent, inner_radius=9, outer_radius=13, sweep=210, thickness=20)
class MapBrowserCard(Widget):
@@ -341,7 +341,7 @@ class _SettingsPage(StarPilotPanel):
# ── shared dialog helpers ──
def _show_slider(self, key, min_v, max_v, step=1, unit="",
value_type="int", current_value=None, title=None):
value_type="int", current_value=None, title=None, color=None):
"""Unified slider dialog (int/float).
title: if provided, used as dialog title; otherwise uses tr(key).
@@ -356,7 +356,7 @@ class _SettingsPage(StarPilotPanel):
current_value = self._params.get_float(key) if value_type == "float" else self._params.get_int(key)
dialog_title = tr(title) if title else tr(key)
gui_app.push_widget(AetherSliderDialog(dialog_title, min_v, max_v, step, current_value, on_close,
unit=unit, color=self.SLIDER_COLOR))
unit=unit, color=self.SLIDER_COLOR if color is None else color))
def _show_string_select(self, key, options, default="None"):
"""String-based multi-option selector (puts string via params.put)."""
@@ -73,7 +73,7 @@ class SoundsManagerView(Widget):
is_active=lambda k=key: self._active_adjustor_key == k,
set_active=lambda active, k=key: self._set_active_adjustor(k, active),
style=PANEL_STYLE,
color=AetherListColors.PRIMARY,
color=PANEL_STYLE.accent,
)
self._adjustor_rows[key] = adjustor
@@ -94,7 +94,7 @@ class SoundsManagerView(Widget):
is_active=lambda: self._active_adjustor_key == cd_key,
set_active=lambda active: self._set_active_adjustor(cd_key, active),
style=PANEL_STYLE,
color=AetherListColors.PRIMARY,
color=PANEL_STYLE.accent,
)
self._adjustor_rows[cd_key] = cd_adjustor
@@ -204,7 +204,7 @@ class SoundsManagerView(Widget):
status_str = tr("ON") if current_val else tr("OFF")
if not is_enabled: status_str = tr(info.get("disabled_label", "UNAVAILABLE"))
draw_toggle_pill(padded_rect, current_val, is_enabled, tr(info["title"]), status_str, hovered, pressed)
draw_toggle_pill(padded_rect, current_val, is_enabled, tr(info["title"]), status_str, hovered, pressed, style=PANEL_STYLE)
self._toggle_rects[key] = padded_rect
@@ -760,7 +760,7 @@ class SystemSettingsManagerView(Widget):
action_text_size=18,
row_separator=PANEL_STYLE.divider_color,
action_fill=AetherListColors.CURRENT_BG,
action_border=rl.Color(89, 116, 151, 42),
action_border=PANEL_STYLE.current_border,
action_text_color=AetherListColors.HEADER,
)
@@ -637,7 +637,7 @@ class StarPilotVehicleSettingsLayout(_SettingsPage):
self._params.put_int("LockDoorsTimer", int(val))
gui_app.push_widget(AetherSliderDialog(tr("Lock Doors Timer"), 0, 300, 5,
self._params.get_int("LockDoorsTimer"), on_close, labels=_lock_doors_timer_labels()))
self._params.get_int("LockDoorsTimer"), on_close, labels=_lock_doors_timer_labels(), color=PANEL_STYLE.accent))
def _show_offset_selector(self):
def on_close(res, val):
@@ -645,7 +645,7 @@ class StarPilotVehicleSettingsLayout(_SettingsPage):
self._params.put_float("ClusterOffset", float(val))
gui_app.push_widget(AetherSliderDialog(tr("Dashboard Speed Offset"), 1.000, 1.050, 0.001,
self._params.get_float("ClusterOffset"), on_close, unit="x"))
self._params.get_float("ClusterOffset"), on_close, unit="x", color=PANEL_STYLE.accent))
def _get_display_make(self) -> str:
make = self._params.get("CarMake", encoding="utf-8") or ""