Customize monochrome palette accent and sidebar colors
- Light mode: accent color linked to sidebar (#212121) - Dark mode: sidebar uses very dark color (#0a0a0a) - Add CSS override for solid monochrome sidebar background Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -225,7 +225,7 @@ export const COLOR_PALETTES: Record<ColorPalette, PaletteColors> = {
|
|||||||
textPrimary: '#0a0a0a',
|
textPrimary: '#0a0a0a',
|
||||||
textSecondary: '#737373',
|
textSecondary: '#737373',
|
||||||
border: '#e5e5e5',
|
border: '#e5e5e5',
|
||||||
sidebarBg: '#1a1a1a',
|
sidebarBg: '#212121',
|
||||||
sidebarText: '#fafafa',
|
sidebarText: '#fafafa',
|
||||||
},
|
},
|
||||||
dark: {
|
dark: {
|
||||||
@@ -501,17 +501,27 @@ export function ThemeProvider({ children }: { children: ReactNode }) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const root = document.documentElement;
|
const root = document.documentElement;
|
||||||
const colors = ACCENT_COLORS[accentColor];
|
let main: string;
|
||||||
// For 'auto' accent, use dark colors in dark mode
|
let hover: string;
|
||||||
const main = (theme === 'dark' && colors.darkMain) ? colors.darkMain : colors.main;
|
|
||||||
const hover = (theme === 'dark' && colors.darkHover) ? colors.darkHover : colors.hover;
|
// Monochrome palette uses the dark sidebar color as accent in light mode only
|
||||||
|
if (colorPalette === 'monochrome' && theme === 'light') {
|
||||||
|
main = '#212121';
|
||||||
|
hover = '#2f2f2f';
|
||||||
|
} else {
|
||||||
|
const colors = ACCENT_COLORS[accentColor];
|
||||||
|
// For 'auto' accent, use dark colors in dark mode
|
||||||
|
main = (theme === 'dark' && colors.darkMain) ? colors.darkMain : colors.main;
|
||||||
|
hover = (theme === 'dark' && colors.darkHover) ? colors.darkHover : colors.hover;
|
||||||
|
}
|
||||||
|
|
||||||
root.style.setProperty('--color-accent', main);
|
root.style.setProperty('--color-accent', main);
|
||||||
root.style.setProperty('--color-accent-hover', hover);
|
root.style.setProperty('--color-accent-hover', hover);
|
||||||
const rgb = hexToRgbString(main);
|
const rgb = hexToRgbString(main);
|
||||||
if (rgb) {
|
if (rgb) {
|
||||||
root.style.setProperty('--color-accent-rgb', rgb);
|
root.style.setProperty('--color-accent-rgb', rgb);
|
||||||
}
|
}
|
||||||
}, [accentColor, theme]);
|
}, [accentColor, theme, colorPalette]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const root = document.documentElement;
|
const root = document.documentElement;
|
||||||
@@ -562,6 +572,9 @@ export function ThemeProvider({ children }: { children: ReactNode }) {
|
|||||||
const palette = COLOR_PALETTES[colorPalette];
|
const palette = COLOR_PALETTES[colorPalette];
|
||||||
const baseColors = theme === 'dark' ? palette.dark : palette.light;
|
const baseColors = theme === 'dark' ? palette.dark : palette.light;
|
||||||
|
|
||||||
|
// Set data-palette attribute for CSS overrides
|
||||||
|
root.dataset.palette = colorPalette;
|
||||||
|
|
||||||
// Apply overrides if they exist for the current theme mode
|
// Apply overrides if they exist for the current theme mode
|
||||||
const overrides = theme === 'dark' ? customColors.dark : customColors.light;
|
const overrides = theme === 'dark' ? customColors.dark : customColors.light;
|
||||||
const appColors = { ...baseColors, ...overrides };
|
const appColors = { ...baseColors, ...overrides };
|
||||||
@@ -576,7 +589,14 @@ export function ThemeProvider({ children }: { children: ReactNode }) {
|
|||||||
// Determine sidebar colors based on sidebarStyle
|
// Determine sidebar colors based on sidebarStyle
|
||||||
let sidebarBg, sidebarText, sidebarBorder;
|
let sidebarBg, sidebarText, sidebarBorder;
|
||||||
|
|
||||||
if (sidebarStyle === 'light') {
|
// Monochrome palette always uses dark sidebar regardless of sidebarStyle or custom overrides
|
||||||
|
if (colorPalette === 'monochrome') {
|
||||||
|
// Use palette colors directly, ignoring any custom overrides for sidebar
|
||||||
|
const monochromeColors = theme === 'dark' ? palette.dark : palette.light;
|
||||||
|
sidebarBg = monochromeColors.sidebarBg;
|
||||||
|
sidebarText = monochromeColors.sidebarText;
|
||||||
|
sidebarBorder = theme === 'dark' ? 'rgba(255, 255, 255, 0.12)' : 'rgba(255, 255, 255, 0.05)';
|
||||||
|
} else if (sidebarStyle === 'light') {
|
||||||
// Always Light: Use light palette colors (bgCard for slight contrast vs bgMain if main is white)
|
// Always Light: Use light palette colors (bgCard for slight contrast vs bgMain if main is white)
|
||||||
// Check for light mode overrides
|
// Check for light mode overrides
|
||||||
const lightOverrides = customColors.light || {};
|
const lightOverrides = customColors.light || {};
|
||||||
@@ -591,13 +611,7 @@ export function ThemeProvider({ children }: { children: ReactNode }) {
|
|||||||
// This respects the user's preference for the default dark sidebar in light mode
|
// This respects the user's preference for the default dark sidebar in light mode
|
||||||
sidebarBg = appColors.sidebarBg;
|
sidebarBg = appColors.sidebarBg;
|
||||||
sidebarText = appColors.sidebarText;
|
sidebarText = appColors.sidebarText;
|
||||||
|
sidebarBorder = 'rgba(255, 255, 255, 0.05)';
|
||||||
// Increase visibility for monochrome dark
|
|
||||||
if (colorPalette === 'monochrome' && theme === 'dark') {
|
|
||||||
sidebarBorder = 'rgba(255, 255, 255, 0.12)';
|
|
||||||
} else {
|
|
||||||
sidebarBorder = 'rgba(255, 255, 255, 0.05)';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
root.style.setProperty('--color-bg-sidebar', sidebarBg);
|
root.style.setProperty('--color-bg-sidebar', sidebarBg);
|
||||||
|
|||||||
@@ -36,6 +36,12 @@
|
|||||||
.sidebar.open {
|
.sidebar.open {
|
||||||
backdrop-filter: blur(24px) saturate(1.2);
|
backdrop-filter: blur(24px) saturate(1.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Monochrome palette uses solid dark sidebar, no transparency */
|
||||||
|
[data-palette='monochrome'] .sidebar {
|
||||||
|
background: var(--color-bg-sidebar);
|
||||||
|
backdrop-filter: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar.clickable {
|
.sidebar.clickable {
|
||||||
|
|||||||
Reference in New Issue
Block a user