feat: add environment-based CSS theming with configurable colors and branding

This commit is contained in:
2026-04-26 16:47:48 +09:30
parent 37e5de7f92
commit d8828d64f2
16 changed files with 262 additions and 39 deletions
+63 -2
View File
@@ -4,6 +4,60 @@
// Base URL without /api/v1 suffix - used for CLI sign URL
const BASE_URL = import.meta.env.VITE_API_BASE_URL || "http://192.168.64.7:8888";
// Theme configuration from environment
export type ThemeName = "default" | "dev" | "preprod";
interface ThemeColors {
primary: string;
primaryForeground: string;
sidebarPrimary: string;
sidebarPrimaryForeground: string;
ring: string;
}
const THEME_COLORS: Record<ThemeName, ThemeColors> = {
default: {
primary: "173 65% 36%", // teal
primaryForeground: "0 0% 100%",
sidebarPrimary: "173 65% 36%",
sidebarPrimaryForeground: "0 0% 100%",
ring: "173 65% 36%",
},
dev: {
primary: "0 72% 51%", // red
primaryForeground: "0 0% 100%",
sidebarPrimary: "0 72% 51%",
sidebarPrimaryForeground: "0 0% 100%",
ring: "0 72% 51%",
},
preprod: {
primary: "270 70% 55%", // purple
primaryForeground: "0 0% 100%",
sidebarPrimary: "270 70% 55%",
sidebarPrimaryForeground: "0 0% 100%",
ring: "270 70% 55%",
},
};
const THEME_DEFAULTS: Record<ThemeName, { appName: string; favicon: string }> = {
default: {
appName: "Secuird",
favicon: "/favicon.svg",
},
dev: {
appName: "Secuird Dev",
favicon: "/favicon-dev.svg",
},
preprod: {
appName: "Secuird Staging",
favicon: "/favicon-staging.svg",
},
};
const themeName = (import.meta.env.VITE_THEME || "default") as ThemeName;
const themeColors = THEME_COLORS[themeName] || THEME_COLORS.default;
const themeDefaults = THEME_DEFAULTS[themeName] || THEME_DEFAULTS.default;
export const config = {
// API Configuration
api: {
@@ -13,10 +67,17 @@ export const config = {
// Sign URL for CLI (same as base URL, no /api/v1)
signUrl: BASE_URL,
// App metadata
// App metadata - can be overridden per-theme or via env
app: {
name: "Secuird",
name: import.meta.env.VITE_APP_NAME || themeDefaults.appName,
description: "Identity & Access Platform",
favicon: import.meta.env.VITE_FAVICON || themeDefaults.favicon,
},
// Theme configuration for CSS variable injection
theme: {
name: themeName,
colors: themeColors,
},
// Feature flags