Fix admin theme dark fallbacks
This commit is contained in:
@@ -97,22 +97,23 @@ function isDarkColor(color: string): boolean {
|
|||||||
|
|
||||||
export function useAdminTheme() {
|
export function useAdminTheme() {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
|
const background = String(theme.background?.val ?? ADMIN_COLORS.surfaceMuted);
|
||||||
|
const isDark = isDarkColor(background);
|
||||||
|
|
||||||
// Resolve core colors
|
// Resolve core colors
|
||||||
const primary = String(theme.primary?.val ?? ADMIN_COLORS.primary);
|
const primary = String(theme.primary?.val ?? ADMIN_COLORS.primary);
|
||||||
const surface = String(theme.surface?.val ?? ADMIN_COLORS.surface);
|
const surface = String(theme.surface?.val ?? (isDark ? '#0F1B36' : ADMIN_COLORS.surface));
|
||||||
const border = String(theme.borderColor?.val ?? ADMIN_COLORS.border);
|
const border = String(theme.borderColor?.val ?? (isDark ? '#1F2A4A' : ADMIN_COLORS.border));
|
||||||
const text = String(theme.color?.val ?? ADMIN_COLORS.text);
|
const text = String(theme.color?.val ?? (isDark ? '#F8FAFF' : ADMIN_COLORS.text));
|
||||||
|
|
||||||
// Muted/Subtle should NOT use theme.muted (which is a background color in Tamagui standard)
|
// Muted/Subtle should NOT use theme.muted (which is a background color in Tamagui standard)
|
||||||
// Instead, we derive them from Text with opacity or use specific palette values if available
|
// Instead, we derive them from Text with opacity or use specific palette values if available
|
||||||
// But safer is Alpha since it works in both Light (Dark Text) and Dark (Light Text) modes.
|
// But safer is Alpha since it works in both Light (Dark Text) and Dark (Light Text) modes.
|
||||||
const muted = withAlpha(text, 0.65);
|
const muted = withAlpha(text, 0.65);
|
||||||
const subtle = withAlpha(text, 0.45);
|
const subtle = withAlpha(text, 0.45);
|
||||||
|
const surfaceMuted = String(theme.muted?.val ?? (isDark ? '#121F3D' : ADMIN_COLORS.surfaceMuted));
|
||||||
|
|
||||||
const background = String(theme.background?.val ?? ADMIN_COLORS.surfaceMuted);
|
|
||||||
const isDark = isDarkColor(background);
|
|
||||||
|
|
||||||
const glassSurface = withAlpha(surface, isDark ? 0.90 : 0.85);
|
const glassSurface = withAlpha(surface, isDark ? 0.90 : 0.85);
|
||||||
const glassSurfaceStrong = withAlpha(surface, isDark ? 0.96 : 0.95);
|
const glassSurfaceStrong = withAlpha(surface, isDark ? 0.96 : 0.95);
|
||||||
const glassBorder = withAlpha(border, 0.5);
|
const glassBorder = withAlpha(border, 0.5);
|
||||||
@@ -123,7 +124,7 @@ export function useAdminTheme() {
|
|||||||
theme,
|
theme,
|
||||||
background,
|
background,
|
||||||
surface,
|
surface,
|
||||||
surfaceMuted: String(theme.muted?.val ?? ADMIN_COLORS.surfaceMuted), // Use theme.muted as BG
|
surfaceMuted,
|
||||||
border,
|
border,
|
||||||
text,
|
text,
|
||||||
textStrong: text, // Alias
|
textStrong: text, // Alias
|
||||||
|
|||||||
Reference in New Issue
Block a user