fix(chart): improve error handling and color variety

- Add quotaExceeded flag to response for better error UX
- Show dedicated quota exceeded state with upgrade button
- Improve AI prompt to better detect data patterns
- Add chart type-specific colors (blue, indigo, emerald, violet, etc.)
- Replace generic primary/10 colors with varied accent colors

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Antigravity
2026-05-23 09:19:52 +00:00
parent a122a0eade
commit 18ffd76c1e
16 changed files with 1042 additions and 134 deletions

View File

@@ -3,8 +3,9 @@
*/
import { normalizeThemeId } from './apply-document-theme'
export function getThemeScript(serverTheme: string = 'light') {
export function getThemeScript(serverTheme: string = 'light', serverAccentColor: string | null = null) {
const fallback = normalizeThemeId(serverTheme)
const defaultAccent = serverAccentColor || '#A47148'
return `
(function() {
try {
@@ -28,7 +29,8 @@ export function getThemeScript(serverTheme: string = 'light') {
if (theme === 'midnight') root.classList.add('dark');
}
var accentStored = localStorage.getItem('accent-color');
if (accentStored) root.style.setProperty('--color-brand-accent', accentStored);
var effectiveAccent = accentStored || ${JSON.stringify(defaultAccent)};
root.style.setProperty('--color-brand-accent', effectiveAccent);
} catch (e) {
console.error('Theme script error', e);
}