Guest User

Untitled

a guest
Jun 23rd, 2025
39
0
148 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.80 KB | None | 0 0
  1. # Color Unification Mapping for --
  2.  
  3. **[2025-06-09] - Created comprehensive color mapping system for strategy builder theme customization**
  4.  
  5. ## Overview
  6.  
  7. This document maps all color usage locations across the -- platform and proposes a unified color system for customizable themes. The color customization will apply to:
  8. - ✅ Strategy Builder (node editor)
  9. - ✅ Results Charts (Chart.jsx, MultiChart.jsx)
  10. - ✅ Global Strategy Options panel
  11. - ❌ Documentation, Pricing, Landing pages (excluded from customization)
  12.  
  13. ## Proposed Color System
  14.  
  15. ### Brand Colors (Primary System)
  16. ```javascript
  17. const brandColors = {
  18. light: {
  19. primary: '#2d3e4f',
  20. secondary: '#006064',
  21. tertiary: '#219f3d',
  22. alternate: '#48a3fe'
  23. },
  24. dark: {
  25. primary: '#2d4f48',
  26. secondary: '#006064',
  27. tertiary: '#0d47a1',
  28. alternate: '#2d3e4f'
  29. }
  30. }
  31. ```
  32.  
  33. ### Utility Colors
  34. ```javascript
  35. const utilityColors = {
  36. light: {
  37. primaryText: '#363636',
  38. secondaryText: '#6f6f6f',
  39. primaryBackground: '#f8f8f8',
  40. secondaryBackground: '#a4a4a4'
  41. },
  42. dark: {
  43. primaryText: '#d9d9d9',
  44. secondaryText: '#6f6f6f',
  45. primaryBackground: '#121212',
  46. secondaryBackground: '#292929'
  47. }
  48. }
  49. ```
  50.  
  51. ### Accent Colors
  52. ```javascript
  53. const accentColors = {
  54. light: {
  55. accent1: '#2e7d32', // Success green
  56. accent2: '#420e60', // Deep purple
  57. accent3: '#00bcd4', // Cyan
  58. accent4: '#795548' // Brown
  59. },
  60. dark: {
  61. accent1: '#2e7d32', // Success green
  62. accent2: '#420e60', // Deep purple
  63. accent3: '#17004f', // Dark blue
  64. accent4: '#4e342e' // Dark brown
  65. }
  66. }
  67. ```
  68.  
  69. ### Semantic Colors
  70. ```javascript
  71. const semanticColors = {
  72. light: {
  73. success: '#8bc34a',
  74. error: '#f44336',
  75. warning: '#ffeb3b',
  76. info: '#219f3d'
  77. },
  78. dark: {
  79. success: '#558b2f',
  80. error: '#771c1c',
  81. warning: '#fbc02d',
  82. info: '#0d47a1'
  83. }
  84. }
  85. ```
  86.  
  87. ## Current Color Usage Locations
  88.  
  89. ### 1. Strategy Builder & Node Editor
  90.  
  91. #### Core Node Colors
  92. - **File:** `frontend-react/src/components/StrategyFlowEditor.jsx`
  93. - Line 100: `boxShadow: selected ? '0 0 0 2px #006064, 0 2px 12px #0008' : '0 2px 12px #0008'`
  94. - Line 101: `background: '#23272f'`
  95. - Line 103: `border: selected ? '2px solid #006064' : '1.5px solid #333'`
  96. - Line 120: `Handle` background: `#006064`
  97. - Line 642: Edge stroke colors: `#DC2626`, `#FFD700`, `#56657F`, `#B0BEC5`
  98. - **Proposed Mapping:**
  99. - `#006064` → `brandColors.secondary`
  100. - `#23272f` → `utilityColors.primaryBackground`
  101. - `#333` → `utilityColors.secondaryBackground`
  102.  
  103. #### Portfolio Node Colors
  104. - **Files:** `frontend-react/src/components/nodes/portfolio/*.jsx`
  105. - Header Background: `#250827` (consistent across all portfolio nodes)
  106. - Border Color: `#250827`
  107. - Handle Color: `#420E60`
  108. - **Proposed Mapping:**
  109. - `#250827` → `accentColors.accent2` (portfolio category color)
  110. - `#420E60` → `accentColors.accent2` (handle color)
  111.  
  112. #### Operator Node Colors
  113. - **Files:** `frontend-react/src/components/nodes/operator/*.jsx`
  114. - Header Background: `#006064` (consistent across operator nodes)
  115. - Handle Color: `#420E60`
  116. - **Proposed Mapping:**
  117. - `#006064` → `brandColors.secondary`
  118. - `#420E60` → `accentColors.accent2`
  119.  
  120. ### 2. Chart Components
  121.  
  122. #### Main Chart (Chart.jsx)
  123. - **File:** `frontend-react/src/components/Chart.jsx`
  124. - Line 55: Background gradient: `linear-gradient(135deg, #0B1426 0%, #1A1F2E 30%, #0F1419 100%)`
  125. - Line 89: Indicator color fallback: `#FFD700`
  126. - Line 127: Text color: `#E8EAED`
  127. - Line 194: Secondary text: `#B0B7C3`
  128. - Line 305: Accent color: `#00D4FF`
  129. - **Proposed Mapping:**
  130. - Background gradient → `utilityColors.primaryBackground` (adaptive)
  131. - `#FFD700` → `accentColors.accent3` (chart indicators)
  132. - `#E8EAED` → `utilityColors.primaryText`
  133. - `#B0B7C3` → `utilityColors.secondaryText`
  134. - `#00D4FF` → `brandColors.tertiary`
  135.  
  136. #### Multi Chart (MultiChart.jsx)
  137. - **File:** `frontend-react/src/components/MultiChart.jsx`
  138. - Line 41: Buy/sell signal colors: `#26FF7F`, `#FF4757`
  139. - Line 108: Background gradient: `linear-gradient(135deg, #0B1426 0%, #1A1F2E 30%, #0F1419 100%)`
  140. - Line 220: Signal border colors: `#26FF7F`, `#FF4757`
  141. - Line 591: Accent color: `#00D4FF`
  142. - **Proposed Mapping:**
  143. - `#26FF7F` → `semanticColors.success` (buy signals)
  144. - `#FF4757` → `semanticColors.error` (sell signals)
  145. - `#00D4FF` → `brandColors.tertiary`
  146.  
  147. ### 3. Global Strategy Options
  148.  
  149. #### Global Strategy Options Panel
  150. - **File:** `frontend-react/src/components/sections/GlobalStrategyOptions.jsx`
  151. - Line 121: Accent color: `theme.palette.mode === 'dark' ? '#00E5C7' : '#009688'`
  152. - Line 800: Button background: `theme.palette.mode === 'dark' ? '#00BFA5' : '#00796B'`
  153. - Line 890-891: Error colors: `#771c1c`, `#5a1515`
  154. - **Proposed Mapping:**
  155. - `#00E5C7`/`#009688` → `brandColors.secondary`
  156. - `#00BFA5`/`#00796B` → `brandColors.secondary` (button variant)
  157. - `#771c1c` → `semanticColors.error`
  158.  
  159. #### Action Buttons
  160. - **File:** `frontend-react/src/components/sections/ActionButtons.jsx`
  161. - Line 80-81: Border/text colors: `#0FF4C6`, `#006064`
  162. - Line 148: Hover colors: `#0FF4C6`, `#006064`
  163. - **Proposed Mapping:**
  164. - `#0FF4C6` → `brandColors.primary` (dark mode)
  165. - `#006064` → `brandColors.secondary`
  166.  
  167. ### 4. Backend Chart Configuration
  168.  
  169. #### Graph Executor Chart Colors
  170. - **File:** `backend/utils/graph_executor.py`
  171. - Line 749: Default indicator color: `#FFD700`
  172. - Line 751: Moving average color: `#87CEEB`
  173. - Line 755: RSI color: `#FF6347`
  174. - Line 760: MACD color: `#00CED1`
  175. - Line 766: Stochastic color: `#DDA0DD`
  176. - Line 776: Bollinger Bands colors: `#9370DB`, `#BA55D3`
  177. - **Proposed Mapping:**
  178. - `#FFD700` → `accentColors.accent3` (default indicator)
  179. - `#87CEEB` → `brandColors.tertiary` (moving averages)
  180. - `#FF6347` → `semanticColors.warning` (oscillators)
  181. - `#00CED1` → `brandColors.secondary` (momentum)
  182. - `#DDA0DD` → `accentColors.accent1` (stochastic)
  183. - `#9370DB` → `accentColors.accent2` (bands)
  184.  
  185. ### 5. Sidebar Components
  186.  
  187. #### Sliding Sidebar
  188. - **File:** `frontend-react/src/components/sidebar/SlidingSidebar.jsx`
  189. - Line 80: Menu highlight: `#2d3e4f`
  190. - Various lines: Themed text colors using conditional logic
  191. - **Proposed Mapping:**
  192. - `#2d3e4f` → `brandColors.primary`
  193.  
  194. ### 6. Utility Components
  195.  
  196. #### Enhanced Tooltip
  197. - **File:** `frontend-react/src/components/utils/EnhancedTooltip.jsx`
  198. - Line 15: Accent color: `theme.palette.mode === 'dark' ? '#00E5C7' : '#009688'`
  199. - **Proposed Mapping:**
  200. - `#00E5C7`/`#009688` → `brandColors.secondary`
  201.  
  202. #### Edge Types
  203. - **File:** `frontend-react/src/components/utils/edgeTypes.jsx`
  204. - Line 45: Hover stroke: `#6b0f1a`
  205. - Line 62: Delete icon colors: `#6b0f1a`, `#fff`
  206. - **Proposed Mapping:**
  207. - `#6b0f1a` → `semanticColors.error`
  208.  
  209. ## Database Integration & Serialization
  210.  
  211. ### User Colors Database Schema
  212. The color customization data is stored in the `user_profiles.user_colors` JSONB column with the following structure:
  213.  
  214. ```json
  215. {
  216. "light": {
  217. "brand": {
  218. "primary": "#2d3e4f",
  219. "secondary": "#006064",
  220. "tertiary": "#219f3d",
  221. "alternate": "#48a3fe"
  222. },
  223. "utility": {
  224. "primaryText": "#363636",
  225. "secondaryText": "#6f6f6f",
  226. "primaryBackground": "#f8f8f8",
  227. "secondaryBackground": "#a4a4a4"
  228. },
  229. "accent": {
  230. "accent1": "#2e7d32",
  231. "accent2": "#420e60",
  232. "accent3": "#00bcd4",
  233. "accent4": "#795548"
  234. },
  235. "semantic": {
  236. "success": "#8bc34a",
  237. "error": "#f44336",
  238. "warning": "#ffeb3b",
  239. "info": "#219f3d"
  240. },
  241. "nodeEditor": {
  242. "canvasBackground": "#f8f9fa",
  243. "gridLines": "#e9ecef40",
  244. "nodeIndicator": "#ffa500",
  245. "nodeOperator": "#006064",
  246. "nodePortfolio": "#6f42c1",
  247. "nodeAction": "#dc3545",
  248. "nodeEvent": "#7c3aed",
  249. "nodeSelected": "#007bff",
  250. "nodeHover": "#00000010",
  251. "handleDefault": "#6c757d",
  252. "handleConnected": "#28a745",
  253. "edgeDefault": "#adb5bd",
  254. "edgeActive": "#007bff",
  255. "selectionBox": "#007bff40"
  256. },
  257. "resultsCharts": {
  258. "priceUp": "#198754",
  259. "priceDown": "#dc3545",
  260. "priceNeutral": "#495057",
  261. "volumeHigh": "#0dcaf0",
  262. "volumeLow": "#0dcaf040",
  263. "indicatorPrimary": "#fd7e14",
  264. "indicatorSecondary": "#6610f2",
  265. "indicatorTertiary": "#d63384",
  266. "buySignal": "#198754",
  267. "sellSignal": "#dc3545",
  268. "chartBackground": "#ffffff",
  269. "chartGrid": "#f8f9fa",
  270. "chartAxis": "#6c757d",
  271. "tooltipBackground": "#f8f9fa",
  272. "tooltipText": "#212529"
  273. }
  274. },
  275. "dark": {
  276. "brand": {
  277. "primary": "#2d4f48",
  278. "secondary": "#006064",
  279. "tertiary": "#0d47a1",
  280. "alternate": "#2d3e4f"
  281. },
  282. "utility": {
  283. "primaryText": "#d9d9d9",
  284. "secondaryText": "#6f6f6f",
  285. "primaryBackground": "#121212",
  286. "secondaryBackground": "#292929"
  287. },
  288. "accent": {
  289. "accent1": "#2e7d32",
  290. "accent2": "#420e60",
  291. "accent3": "#17004f",
  292. "accent4": "#4e342e"
  293. },
  294. "semantic": {
  295. "success": "#558b2f",
  296. "error": "#771c1c",
  297. "warning": "#fbc02d",
  298. "info": "#0d47a1"
  299. },
  300. "nodeEditor": {
  301. "canvasBackground": "#0f1419",
  302. "gridLines": "#1a1f2e",
  303. "nodeIndicator": "#ffd700",
  304. "nodeOperator": "#006064",
  305. "nodePortfolio": "#250827",
  306. "nodeAction": "#dc2626",
  307. "nodeEvent": "#7c3aed",
  308. "nodeSelected": "#00e5c7",
  309. "nodeHover": "#ffffff20",
  310. "handleDefault": "#420e60",
  311. "handleConnected": "#00ff7f",
  312. "edgeDefault": "#56657f",
  313. "edgeActive": "#00e5c7",
  314. "selectionBox": "#00e5c740"
  315. },
  316. "resultsCharts": {
  317. "priceUp": "#26ff7f",
  318. "priceDown": "#ff4757",
  319. "priceNeutral": "#e8eaed",
  320. "volumeHigh": "#00d4ff",
  321. "volumeLow": "#00d4ff40",
  322. "indicatorPrimary": "#ffd700",
  323. "indicatorSecondary": "#87ceeb",
  324. "indicatorTertiary": "#ff6347",
  325. "buySignal": "#26ff7f",
  326. "sellSignal": "#ff4757",
  327. "chartBackground": "#0b1426",
  328. "chartGrid": "#1a1f2e40",
  329. "chartAxis": "#b0b7c3",
  330. "tooltipBackground": "#1a1f2e",
  331. "tooltipText": "#e8eaed"
  332. }
  333. }
  334. }
  335. ```
  336.  
  337. ### Backend API Integration
  338.  
  339. #### Update User Colors Endpoint
  340. ```python
  341. # backend/utils/supabase_profiles.py - EXISTING FUNCTION
  342. def update_user_colors(user_id: str, user_colors: Dict[str, str]) -> Dict[str, Any]:
  343. """
  344. Update user's color customization settings.
  345.  
  346. Args:
  347. user_id: UUID of the user
  348. user_colors: Complete color configuration object
  349.  
  350. Returns:
  351. Updated profile data dict
  352. """
  353. ```
  354.  
  355. #### FastAPI Endpoint Addition
  356. ```python
  357. # backend/auth/routes.py - NEW ENDPOINT NEEDED
  358. @router.put("/user/colors")
  359. async def update_user_colors(
  360. colors_data: Dict[str, Any],
  361. current_user = Depends(get_current_user)
  362. ):
  363. """Update user's color customization settings."""
  364. try:
  365. updated_profile = update_user_colors(current_user.id, colors_data)
  366. return {"success": True, "user_colors": updated_profile.get("user_colors")}
  367. except Exception as e:
  368. raise HTTPException(status_code=500, detail=str(e))
  369.  
  370. @router.get("/user/colors")
  371. async def get_user_colors(current_user = Depends(get_current_user)):
  372. """Get user's current color settings."""
  373. try:
  374. profile = get_user_profile(current_user.id)
  375. return {"user_colors": profile.get("user_colors") if profile else None}
  376. except Exception as e:
  377. raise HTTPException(status_code=500, detail=str(e))
  378. ```
  379.  
  380. ### Frontend Integration Strategy
  381.  
  382. #### 1. Color Context System
  383. ```javascript
  384. // frontend-react/src/context/ColorContext.jsx - NEW FILE NEEDED
  385. import { createContext, useContext, useState, useEffect } from 'react';
  386.  
  387. const ColorContext = createContext();
  388.  
  389. export const useColors = () => {
  390. const context = useContext(ColorContext);
  391. if (!context) {
  392. throw new Error('useColors must be used within ColorProvider');
  393. }
  394. return context;
  395. };
  396.  
  397. export const ColorProvider = ({ children }) => {
  398. const [userColors, setUserColors] = useState(null);
  399. const [isLoading, setIsLoading] = useState(true);
  400.  
  401. // Load colors on login
  402. useEffect(() => {
  403. loadUserColors();
  404. }, []);
  405.  
  406. const loadUserColors = async () => {
  407. try {
  408. const response = await fetch('/api/auth/user/colors');
  409. const data = await response.json();
  410. setUserColors(data.user_colors || getDefaultColors());
  411. } catch (error) {
  412. console.error('Failed to load user colors:', error);
  413. setUserColors(getDefaultColors());
  414. } finally {
  415. setIsLoading(false);
  416. }
  417. };
  418.  
  419. const updateColors = async (newColors) => {
  420. try {
  421. const response = await fetch('/api/auth/user/colors', {
  422. method: 'PUT',
  423. headers: { 'Content-Type': 'application/json' },
  424. body: JSON.stringify(newColors)
  425. });
  426.  
  427. if (response.ok) {
  428. setUserColors(newColors);
  429. applyColorsToDOM(newColors);
  430. }
  431. } catch (error) {
  432. console.error('Failed to update colors:', error);
  433. }
  434. };
  435.  
  436. const applyColorsToDOM = (colors) => {
  437. const root = document.documentElement;
  438. const currentTheme = getCurrentTheme(); // 'light' or 'dark'
  439. const themeColors = colors[currentTheme];
  440.  
  441. // Apply CSS custom properties
  442. Object.entries(themeColors.brand).forEach(([key, value]) => {
  443. root.style.setProperty(`--brand-${key}`, value);
  444. });
  445. Object.entries(themeColors.utility).forEach(([key, value]) => {
  446. root.style.setProperty(`--utility-${key}`, value);
  447. });
  448. Object.entries(themeColors.accent).forEach(([key, value]) => {
  449. root.style.setProperty(`--accent-${key}`, value);
  450. });
  451. Object.entries(themeColors.semantic).forEach(([key, value]) => {
  452. root.style.setProperty(`--semantic-${key}`, value);
  453. });
  454. };
  455.  
  456. return (
  457. <ColorContext.Provider value={{
  458. userColors,
  459. updateColors,
  460. loadUserColors,
  461. isLoading,
  462. getColor: (theme, category, colorName) => {
  463. return userColors?.[theme]?.[category]?.[colorName] || '#000000';
  464. }
  465. }}>
  466. {children}
  467. </ColorContext.Provider>
  468. );
  469. };
  470. ```
  471.  
  472. #### 2. CSS Custom Properties Integration
  473. ```css
  474. /* frontend-react/src/styles/colors.css - NEW FILE NEEDED */
  475. :root {
  476. /* Default colors - will be overridden by ColorContext */
  477. --brand-primary: #2d3e4f;
  478. --brand-secondary: #006064;
  479. --brand-tertiary: #219f3d;
  480. --brand-alternate: #48a3fe;
  481.  
  482. --utility-primaryText: #363636;
  483. --utility-secondaryText: #6f6f6f;
  484. --utility-primaryBackground: #f8f8f8;
  485. --utility-secondaryBackground: #a4a4a4;
  486.  
  487. --accent-accent1: #2e7d32;
  488. --accent-accent2: #420e60;
  489. --accent-accent3: #00bcd4;
  490. --accent-accent4: #795548;
  491.  
  492. --semantic-success: #8bc34a;
  493. --semantic-error: #f44336;
  494. --semantic-warning: #ffeb3b;
  495. --semantic-info: #219f3d;
  496. }
  497.  
  498. [data-theme="dark"] {
  499. --brand-primary: #2d4f48;
  500. --brand-secondary: #006064;
  501. --brand-tertiary: #0d47a1;
  502. --brand-alternate: #2d3e4f;
  503.  
  504. --utility-primaryText: #d9d9d9;
  505. --utility-secondaryText: #6f6f6f;
  506. --utility-primaryBackground: #121212;
  507. --utility-secondaryBackground: #292929;
  508.  
  509. --accent-accent1: #2e7d32;
  510. --accent-accent2: #420e60;
  511. --accent-accent3: #17004f;
  512. --accent-accent4: #4e342e;
  513.  
  514. --semantic-success: #558b2f;
  515. --semantic-error: #771c1c;
  516. --semantic-warning: #fbc02d;
  517. --semantic-info: #0d47a1;
  518. }
  519. ```
  520.  
  521. #### 3. User Interface Component
  522. ```javascript
  523. // frontend-react/src/components/ColorCustomization.jsx - NEW FILE NEEDED
  524. import { useState } from 'react';
  525. import { useColors } from '../context/ColorContext';
  526. import {
  527. Box,
  528. Typography,
  529. Paper,
  530. Grid,
  531. Button,
  532. TextField,
  533. Switch,
  534. FormControlLabel
  535. } from '@mui/material';
  536.  
  537. const ColorPicker = ({ label, value, onChange, category, colorKey }) => {
  538. return (
  539. <Box sx={{ mb: 2 }}>
  540. <Typography variant="body2" sx={{ mb: 1 }}>
  541. {label}
  542. </Typography>
  543. <TextField
  544. type="color"
  545. value={value}
  546. onChange={(e) => onChange(category, colorKey, e.target.value)}
  547. size="small"
  548. sx={{ width: 60 }}
  549. />
  550. <TextField
  551. value={value}
  552. onChange={(e) => onChange(category, colorKey, e.target.value)}
  553. size="small"
  554. sx={{ ml: 1, width: 100 }}
  555. placeholder="#000000"
  556. />
  557. </Box>
  558. );
  559. };
  560.  
  561. export const ColorCustomization = () => {
  562. const { userColors, updateColors, isLoading } = useColors();
  563. const [isDarkMode, setIsDarkMode] = useState(false);
  564. const [localColors, setLocalColors] = useState(userColors);
  565.  
  566. const handleColorChange = (category, colorKey, newValue) => {
  567. const theme = isDarkMode ? 'dark' : 'light';
  568. setLocalColors(prev => ({
  569. ...prev,
  570. [theme]: {
  571. ...prev[theme],
  572. [category]: {
  573. ...prev[theme][category],
  574. [colorKey]: newValue
  575. }
  576. }
  577. }));
  578. };
  579.  
  580. const handleSave = async () => {
  581. await updateColors(localColors);
  582. };
  583.  
  584. const handleReset = () => {
  585. setLocalColors(getDefaultColors());
  586. };
  587.  
  588. if (isLoading) return <Typography>Loading color settings...</Typography>;
  589.  
  590. const currentTheme = isDarkMode ? 'dark' : 'light';
  591. const colors = localColors?.[currentTheme] || {};
  592.  
  593. return (
  594. <Box sx={{ p: 3 }}>
  595. <Typography variant="h5" sx={{ mb: 3 }}>
  596. Color Customization
  597. </Typography>
  598.  
  599. <FormControlLabel
  600. control={
  601. <Switch
  602. checked={isDarkMode}
  603. onChange={(e) => setIsDarkMode(e.target.checked)}
  604. />
  605. }
  606. label={`${isDarkMode ? 'Dark' : 'Light'} Mode Preview`}
  607. />
  608.  
  609. <Grid container spacing={3} sx={{ mt: 2 }}>
  610. {/* Brand Colors */}
  611. <Grid item xs={12} md={3}>
  612. <Paper sx={{ p: 2 }}>
  613. <Typography variant="h6" sx={{ mb: 2 }}>Brand Colors</Typography>
  614. <ColorPicker
  615. label="Primary"
  616. value={colors.brand?.primary || '#2d3e4f'}
  617. onChange={handleColorChange}
  618. category="brand"
  619. colorKey="primary"
  620. />
  621. <ColorPicker
  622. label="Secondary"
  623. value={colors.brand?.secondary || '#006064'}
  624. onChange={handleColorChange}
  625. category="brand"
  626. colorKey="secondary"
  627. />
  628. <ColorPicker
  629. label="Tertiary"
  630. value={colors.brand?.tertiary || '#219f3d'}
  631. onChange={handleColorChange}
  632. category="brand"
  633. colorKey="tertiary"
  634. />
  635. <ColorPicker
  636. label="Alternate"
  637. value={colors.brand?.alternate || '#48a3fe'}
  638. onChange={handleColorChange}
  639. category="brand"
  640. colorKey="alternate"
  641. />
  642. </Paper>
  643. </Grid>
  644.  
  645. {/* Utility Colors */}
  646. <Grid item xs={12} md={3}>
  647. <Paper sx={{ p: 2 }}>
  648. <Typography variant="h6" sx={{ mb: 2 }}>Utility Colors</Typography>
  649. <ColorPicker
  650. label="Primary Text"
  651. value={colors.utility?.primaryText || '#363636'}
  652. onChange={handleColorChange}
  653. category="utility"
  654. colorKey="primaryText"
  655. />
  656. <ColorPicker
  657. label="Secondary Text"
  658. value={colors.utility?.secondaryText || '#6f6f6f'}
  659. onChange={handleColorChange}
  660. category="utility"
  661. colorKey="secondaryText"
  662. />
  663. <ColorPicker
  664. label="Primary Background"
  665. value={colors.utility?.primaryBackground || '#f8f8f8'}
  666. onChange={handleColorChange}
  667. category="utility"
  668. colorKey="primaryBackground"
  669. />
  670. <ColorPicker
  671. label="Secondary Background"
  672. value={colors.utility?.secondaryBackground || '#a4a4a4'}
  673. onChange={handleColorChange}
  674. category="utility"
  675. colorKey="secondaryBackground"
  676. />
  677. </Paper>
  678. </Grid>
  679.  
  680. {/* Accent Colors */}
  681. <Grid item xs={12} md={3}>
  682. <Paper sx={{ p: 2 }}>
  683. <Typography variant="h6" sx={{ mb: 2 }}>Accent Colors</Typography>
  684. <ColorPicker
  685. label="Accent 1 (Success)"
  686. value={colors.accent?.accent1 || '#2e7d32'}
  687. onChange={handleColorChange}
  688. category="accent"
  689. colorKey="accent1"
  690. />
  691. <ColorPicker
  692. label="Accent 2 (Portfolio)"
  693. value={colors.accent?.accent2 || '#420e60'}
  694. onChange={handleColorChange}
  695. category="accent"
  696. colorKey="accent2"
  697. />
  698. <ColorPicker
  699. label="Accent 3 (Charts)"
  700. value={colors.accent?.accent3 || '#00bcd4'}
  701. onChange={handleColorChange}
  702. category="accent"
  703. colorKey="accent3"
  704. />
  705. <ColorPicker
  706. label="Accent 4 (Indicators)"
  707. value={colors.accent?.accent4 || '#795548'}
  708. onChange={handleColorChange}
  709. category="accent"
  710. colorKey="accent4"
  711. />
  712. </Paper>
  713. </Grid>
  714.  
  715. {/* Semantic Colors */}
  716. <Grid item xs={12} md={3}>
  717. <Paper sx={{ p: 2 }}>
  718. <Typography variant="h6" sx={{ mb: 2 }}>Semantic Colors</Typography>
  719. <ColorPicker
  720. label="Success"
  721. value={colors.semantic?.success || '#8bc34a'}
  722. onChange={handleColorChange}
  723. category="semantic"
  724. colorKey="success"
  725. />
  726. <ColorPicker
  727. label="Error"
  728. value={colors.semantic?.error || '#f44336'}
  729. onChange={handleColorChange}
  730. category="semantic"
  731. colorKey="error"
  732. />
  733. <ColorPicker
  734. label="Warning"
  735. value={colors.semantic?.warning || '#ffeb3b'}
  736. onChange={handleColorChange}
  737. category="semantic"
  738. colorKey="warning"
  739. />
  740. <ColorPicker
  741. label="Info"
  742. value={colors.semantic?.info || '#219f3d'}
  743. onChange={handleColorChange}
  744. category="semantic"
  745. colorKey="info"
  746. />
  747. </Paper>
  748. </Grid>
  749. </Grid>
  750.  
  751. <Box sx={{ mt: 3, display: 'flex', gap: 2 }}>
  752. <Button variant="contained" onClick={handleSave}>
  753. Save Colors
  754. </Button>
  755. <Button variant="outlined" onClick={handleReset}>
  756. Reset to Default
  757. </Button>
  758. </Box>
  759. </Box>
  760. );
  761. };
  762. ```
  763.  
  764. ### Database Operations
  765.  
  766. #### Auto-loading Colors on Login
  767. Colors are automatically loaded when the user logs in through the existing authentication flow:
  768.  
  769. ```javascript
  770. // frontend-react/src/context/AuthContext.jsx - MODIFICATION NEEDED
  771. // Add color loading to the login success handler
  772. const handleLoginSuccess = async (user) => {
  773. // ... existing login logic ...
  774.  
  775. // Load user colors after successful login
  776. await loadUserColors(); // This will be called by ColorProvider
  777. };
  778. ```
  779.  
  780. #### Persistence & Synchronization
  781. - **Real-time Updates**: Colors are applied immediately via CSS custom properties
  782. - **Database Sync**: Color changes are persisted to `user_profiles.user_colors` JSONB column
  783. - **Session Management**: Colors persist across browser sessions and device changes
  784. - **Fallback Strategy**: If no custom colors exist, system uses default FlutterFlow-inspired palette
  785.  
  786. ## Implementation Priority
  787.  
  788. ### Phase 1: Core System Setup
  789. 1. Create CSS custom properties file (`frontend-react/src/styles/colors.css`)
  790. 2. Create React ColorContext (`frontend-react/src/context/ColorContext.jsx`)
  791. 3. Add FastAPI endpoints (`backend/auth/routes.py`)
  792. 4. Update theme provider integration
  793.  
  794. ### Phase 2: Node Editor Colors
  795. 1. Replace hardcoded colors in node components
  796. 2. Update handle colors across all node types
  797. 3. Implement selection and hover state colors
  798.  
  799. ### Phase 3: Chart Colors
  800. 1. Update Chart.jsx color system
  801. 2. Update MultiChart.jsx color system
  802. 3. Update backend chart configuration colors
  803.  
  804. ### Phase 4: UI Components
  805. 1. Update Global Strategy Options colors
  806. 2. Update sidebar colors
  807. 3. Update utility component colors
  808.  
  809. ### Phase 5: User Customization
  810. 1. Add color picker components
  811. 2. Implement color persistence
  812. 3. Add preset color themes
  813.  
  814. ## Files Requiring Updates
  815.  
  816. ### High Priority (Core Functionality)
  817. 1. `frontend-react/src/components/StrategyFlowEditor.jsx`
  818. 2. `frontend-react/src/components/Chart.jsx`
  819. 3. `frontend-react/src/components/MultiChart.jsx`
  820. 4. `backend/utils/graph_executor.py`
  821.  
  822. ### Medium Priority (Node Components)
  823. 5. `frontend-react/src/components/nodes/portfolio/*.jsx` (6 files)
  824. 6. `frontend-react/src/components/nodes/operator/*.jsx` (6 files)
  825. 7. `frontend-react/src/components/nodes/indicator/*.jsx` (40+ files)
  826.  
  827. ### Lower Priority (UI Components)
  828. 8. `frontend-react/src/components/sections/GlobalStrategyOptions.jsx`
  829. 9. `frontend-react/src/components/sections/ActionButtons.jsx`
  830. 10. `frontend-react/src/components/sidebar/SlidingSidebar.jsx`
  831. 11. `frontend-react/src/components/utils/EnhancedTooltip.jsx`
  832. 12. `frontend-react/src/components/utils/edgeTypes.jsx`
  833.  
  834. ## Color Accessibility Considerations
  835.  
  836. ### Contrast Ratios
  837. - Ensure all text colors meet WCAG AA standards (4.5:1 contrast ratio)
  838. - Provide high contrast mode option
  839. - Test colors with color blindness simulation
  840.  
  841. ### Color Coding
  842. - Never rely solely on color to convey information
  843. - Provide alternative indicators (shapes, patterns, text labels)
  844. - Support colorblind-friendly palette options
  845.  
  846. ## Enhanced Color System (48 Colors Total)
  847.  
  848. With the addition of Node Editor and Results Charts color categories, subscribers now have **48 customizable colors** per theme mode:
  849.  
  850. ### Light Mode: 48 Colors
  851. - **Brand Colors**: 4 colors (primary, secondary, tertiary, alternate)
  852. - **Utility Colors**: 4 colors (text and background variations)
  853. - **Accent Colors**: 4 colors (categorized functionality)
  854. - **Semantic Colors**: 4 colors (success, error, warning, info)
  855. - **Node Editor Colors**: 15 colors (canvas, nodes, handles, edges, states)
  856. - **Results Charts Colors**: 15 colors (price data, indicators, signals, UI elements)
  857.  
  858. ### Dark Mode: 48 Colors
  859. - Same 48 color categories optimized for dark theme visibility
  860.  
  861. ## Node Editor Color Categories
  862.  
  863. ### Canvas & Layout Colors
  864. - **Canvas Background** (`canvasBackground`): Main editor background
  865. - **Grid Lines** (`gridLines`): Canvas grid overlay
  866. - **Selection Box** (`selectionBox`): Multi-node selection rectangle
  867.  
  868. ### Node Type Colors
  869. - **Indicator Nodes** (`nodeIndicator`): Technical analysis indicators (EMA, RSI, etc.)
  870. - **Operator Nodes** (`nodeOperator`): Logic operators (AND, OR, Math, etc.)
  871. - **Portfolio Nodes** (`nodePortfolio`): Portfolio management nodes
  872. - **Action Nodes** (`nodeAction`): Buy/Sell/Wait action nodes
  873. - **Event Nodes** (`nodeEvent`): Market event nodes (earnings, splits)
  874.  
  875. ### Node State Colors
  876. - **Selected State** (`nodeSelected`): Active/selected node border
  877. - **Hover State** (`nodeHover`): Mouse hover overlay effect
  878.  
  879. ### Connection Colors
  880. - **Default Handle** (`handleDefault`): Unconnected node handles
  881. - **Connected Handle** (`handleConnected`): Connected node handles
  882. - **Default Edge** (`edgeDefault`): Standard connection lines
  883. - **Active Edge** (`edgeActive`): Selected/highlighted connections
  884.  
  885. ## Results Charts Color Categories
  886.  
  887. ### Price Data Colors
  888. - **Price Up** (`priceUp`): Bullish candles/price movements
  889. - **Price Down** (`priceDown`): Bearish candles/price movements
  890. - **Price Neutral** (`priceNeutral`): Neutral/unchanged price data
  891.  
  892. ### Volume Colors
  893. - **Volume High** (`volumeHigh`): High volume bars
  894. - **Volume Low** (`volumeLow`): Low volume bars (with transparency)
  895.  
  896. ### Indicator Colors
  897. - **Indicator Primary** (`indicatorPrimary`): Main indicator lines (EMA, SMA)
  898. - **Indicator Secondary** (`indicatorSecondary`): Secondary indicators (signals)
  899. - **Indicator Tertiary** (`indicatorTertiary`): Additional indicator elements
  900.  
  901. ### Signal Colors
  902. - **Buy Signal** (`buySignal`): Buy action markers
  903. - **Sell Signal** (`sellSignal`): Sell action markers
  904.  
  905. ### Chart UI Colors
  906. - **Chart Background** (`chartBackground`): Main chart area background
  907. - **Chart Grid** (`chartGrid`): Chart grid lines
  908. - **Chart Axis** (`chartAxis`): Axis labels and lines
  909. - **Tooltip Background** (`tooltipBackground`): Tooltip/popup background
  910. - **Tooltip Text** (`tooltipText`): Tooltip text color
  911.  
  912. ## Color Usage Examples
  913.  
  914. ### Node Editor Implementation
  915. ```css
  916. /* Node editor canvas colors */
  917. .react-flow__pane {
  918. background: var(--nodeEditor-canvasBackground);
  919. }
  920.  
  921. .react-flow__grid {
  922. stroke: var(--nodeEditor-gridLines);
  923. }
  924.  
  925. /* Node type colors */
  926. .node-indicator {
  927. background: var(--nodeEditor-nodeIndicator);
  928. }
  929.  
  930. .node-portfolio {
  931. background: var(--nodeEditor-nodePortfolio);
  932. }
  933.  
  934. /* Node states */
  935. .node.selected {
  936. border-color: var(--nodeEditor-nodeSelected);
  937. }
  938.  
  939. .node:hover {
  940. background: var(--nodeEditor-nodeHover);
  941. }
  942.  
  943. /* Handles and edges */
  944. .react-flow__handle {
  945. background: var(--nodeEditor-handleDefault);
  946. }
  947.  
  948. .react-flow__handle.connected {
  949. background: var(--nodeEditor-handleConnected);
  950. }
  951.  
  952. .react-flow__edge {
  953. stroke: var(--nodeEditor-edgeDefault);
  954. }
  955.  
  956. .react-flow__edge.selected {
  957. stroke: var(--nodeEditor-edgeActive);
  958. }
  959. ```
  960.  
  961. ### Charts Implementation
  962. ```css
  963. /* Chart colors */
  964. .echarts-container {
  965. background: var(--resultsCharts-chartBackground);
  966. }
  967.  
  968. .candlestick-up {
  969. color: var(--resultsCharts-priceUp);
  970. }
  971.  
  972. .candlestick-down {
  973. color: var(--resultsCharts-priceDown);
  974. }
  975.  
  976. .buy-signal {
  977. color: var(--resultsCharts-buySignal);
  978. }
  979.  
  980. .sell-signal {
  981. color: var(--resultsCharts-sellSignal);
  982. }
  983.  
  984. .chart-tooltip {
  985. background: var(--resultsCharts-tooltipBackground);
  986. color: var(--resultsCharts-tooltipText);
  987. }
  988. ```
  989.  
  990. ## Next Steps
  991.  
  992. 1. Create CSS custom properties file with all 48 color variables
  993. 2. Set up React ColorContext system with expanded color categories
  994. 3. Begin Phase 1 implementation with core system setup
  995. 4. Test color system with existing components
  996. 5. Implement user customization interface with 6 color category panels
  997. 6. Add color persistence and presets
Advertisement
Add Comment
Please, Sign In to add comment