/
kreyndelHam
/
Konstructorium
Обзор
Документация
Войти
/
kreyndelHam
/
Konstructorium
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
1
CI/CD
Аналитика
Безопасность
dev
frontend/src/utils/chartTheme.js
59 строк
2 KB
MihahamYT
Frontend rebuilded with dark mode
24 май 2026, 15:47
24 май 2026, 15:47
dbcde1d
Код
Авторство
О чём код?
/** * Shared Recharts color palette for light and dark themes. */ /** @type {string[]} */ const SERIES_COLORS = ['#0ea5e9', '#6366f1', '#f97316', '#10b981', '#ef4444', '#8b5cf6', '#14b8a6', '#3b82f6'] /** @type {string[]} */ const ORDER_COLORS = ['#4f46e5', '#06b6d4', '#f59e0b', '#10b981', '#ef4444', '#8b5cf6'] /** @type {string[]} */ const PAYMENT_COLORS = ['#f59e0b', '#10b981', '#ef4444', '#7c3aed'] /** @type {string[]} */ const API_COLORS = ['#10b981', '#f59e0b', '#ef4444'] /** * Build chart styling tokens for the active theme. * * @param {boolean} isDark * @returns {{ * grid: string, * axis: string, * tooltipBg: string, * tooltipBorder: string, * tooltipText: string, * series: string[], * order: string[], * payment: string[], * api: string[], * primary: string, * secondary: string, * accent: string, * error: string, * errorFill: string, * teal: string, * slate: string, * }} */ export function getChartColors(isDark) { return { grid: isDark ? '#374151' : '#e5e7eb', axis: isDark ? '#9ca3af' : '#6b7280', tooltipBg: isDark ? '#1f2937' : '#ffffff', tooltipBorder: isDark ? '#4b5563' : '#e5e7eb', tooltipText: isDark ? '#f9fafb' : '#111827', series: SERIES_COLORS, order: ORDER_COLORS, payment: PAYMENT_COLORS, api: API_COLORS, primary: '#6366f1', secondary: '#2563eb', accent: '#f97316', error: '#ef4444', errorFill: isDark ? '#7f1d1d' : '#fecaca', teal: '#0d9488', slate: isDark ? '#94a3b8' : '#64748b', } }