From c1dc019c8b2819e13da42ad1c2648740a09279d1 Mon Sep 17 00:00:00 2001 From: c0mrade Date: Wed, 4 Feb 2026 12:14:44 +0300 Subject: [PATCH] fix: Aurora animation ignoring light theme background color MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Aurora WebGL всегда использовала darkBackground для color stops, при переключении на светлую тему фон анимации оставался тёмным. Добавлен useTheme() для реактивного определения текущей темы, background выбирается между darkBackground и lightBackground. --- src/components/layout/AppShell/Aurora.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/layout/AppShell/Aurora.tsx b/src/components/layout/AppShell/Aurora.tsx index df056e2..f4c9a7d 100644 --- a/src/components/layout/AppShell/Aurora.tsx +++ b/src/components/layout/AppShell/Aurora.tsx @@ -2,6 +2,7 @@ import { useEffect, useRef } from 'react'; import { useQuery, useQueryClient } from '@tanstack/react-query'; import { Renderer, Program, Mesh, Color, Triangle } from 'ogl'; import { brandingApi } from '@/api/branding'; +import { useTheme } from '@/hooks/useTheme'; import { ThemeSettings, DEFAULT_THEME_COLORS } from '@/types/theme'; const VERT = /* glsl */ `#version 300 es @@ -148,6 +149,10 @@ export function Aurora() { const themeColors = queryClient.getQueryData(['theme-colors']) || DEFAULT_THEME_COLORS; + // Pick background based on current theme + const { isDark } = useTheme(); + const background = isDark ? themeColors.darkBackground : themeColors.lightBackground; + useEffect(() => { if (!isEnabled || !containerRef.current) return; @@ -168,7 +173,7 @@ export function Aurora() { const geometry = new Triangle(gl); - const colorStops = generateColorStops(themeColors.accent, themeColors.darkBackground); + const colorStops = generateColorStops(themeColors.accent, background); const colorStopsArray = colorStops .map((hex) => { const c = new Color(hex); @@ -231,7 +236,7 @@ export function Aurora() { rendererRef.current = null; programRef.current = null; }; - }, [isEnabled, themeColors.accent, themeColors.darkBackground]); + }, [isEnabled, themeColors.accent, background]); if (!isEnabled) { return null;