Theme System Overview
Bimble Chat Vue uses a comprehensive theming system built on Vuetify 3 with dynamic color schemes and dark/light mode support.
Dynamic Color Schemes
The application supports 5 predefined color schemes (Blue, Aqua, Purple, Green, Cyan) with real-time theme switching and automatic dark mode adaptations.
Available Color Schemes
Choose from 5 carefully crafted color schemes, each with light and dark mode variations:
Blue (Default)
Dark Mode Colors:
Aqua
Dark Mode Colors:
Purple
Dark Mode Colors:
Green
Dark Mode Colors:
Cyan
Dark Mode Colors:
Theme Management System
The theming system consists of several key components working together:
Color Scheme Store
Pinia store managing the active color scheme state with 5 predefined schemes
Settings Store
Manages theme mode (light/dark), language, and layout settings
Theme Utilities
Dynamic theme color application and dark mode color generation
Theme Initializer
Composable for initializing and watching theme changes
Using Color Schemes
// Using the color scheme store
import { useColorSchemeStore } from '@/stores/colorSchemeStore'
export default {
setup() {
const colorSchemeStore = useColorSchemeStore()
// Get available color schemes
const availableSchemes = computed(() => colorSchemes)
// Get current color scheme
const currentScheme = computed(() => colorSchemeStore.currentColorScheme)
// Change color scheme
const changeColorScheme = (schemeName) => {
colorSchemeStore.setColorScheme(schemeName)
}
return {
availableSchemes,
currentScheme,
changeColorScheme
}
}
}
// Using the settings store for dark mode
import { useSettingsStore } from '@/stores/settingsStore'
export default {
setup() {
const settings = useSettingsStore()
// Check if dark mode is active
const isDarkMode = computed(() => settings.isDarkMode)
// Toggle dark mode
const toggleDarkMode = () => {
settings.SET_DARK_MODE(!settings.isDarkMode)
}
// Set specific theme
const setTheme = (themeName) => {
settings.SET_THEME(themeName) // 'LIGHT_THEME' or 'DARK_THEME'
}
return {
isDarkMode,
toggleDarkMode,
setTheme
}
}
}
// Initialize theming in your app
import { useThemeInitializer } from '@/composables/useThemeInitializer'
export default {
setup() {
// Initialize theme system
const { initializeTheme } = useThemeInitializer()
// Theme will be automatically initialized and watched for changes
// - Default: Blue color scheme in light mode
// - Watches for color scheme changes
// - Watches for dark/light mode changes
// - Applies colors dynamically to Vuetify theme
return {}
}
}
Light Theme Colors
The following colors are used in the light theme configuration:
Primary & Secondary Colors
Status Colors
Light Status Colors
Text & Border Colors
Background Colors
Grey Scale Colors
Dark Theme Colors
The following colors are used in the dark theme configuration (showing key differences):
Primary & Secondary Colors
Light Status Colors (Dark)
Text & Border Colors (Dark)
Background Colors (Dark)
Grey Scale Colors (Dark)
Theme Configuration Files
LightTheme.ts
Light theme configuration with bright colors and clean aesthetics
DarkTheme.ts
Dark theme configuration optimized for low-light environments
colorSchemeStore.ts
Pinia store managing theme state and switching logic
useThemeInitializer.ts
Composable for initializing and managing theme settings
Implementation Examples
Using Vuetify Theme Colors
/* Using Vuetify theme colors in your CSS */
.custom-component {
background-color: rgb(var(--v-theme-surface));
color: rgb(var(--v-theme-on-surface));
border: 1px solid rgb(var(--v-theme-outline));
}
.success-message {
background-color: rgb(var(--v-theme-success));
color: rgb(var(--v-theme-on-success));
padding: 1rem;
border-radius: 8px;
}
Theme Store Usage
// Using the theme store in a Vue component
import { useColorSchemeStore } from '@/stores/colorSchemeStore'
export default {
setup() {
const colorSchemeStore = useColorSchemeStore()
const toggleTheme = () => {
colorSchemeStore.toggleScheme()
}
return {
isDarkMode: computed(() => colorSchemeStore.isDarkMode),
currentTheme: computed(() => colorSchemeStore.getColorScheme),
toggleTheme
}
}
}
// Using with Options API
import { mapStores } from 'pinia'
import { useColorSchemeStore } from '@/stores/colorSchemeStore'
export default {
computed: {
...mapStores(useColorSchemeStore),
isDarkMode() {
return this.colorSchemeStore.isDarkMode
},
currentTheme() {
return this.colorSchemeStore.getColorScheme
}
},
methods: {
toggleTheme() {
this.colorSchemeStore.toggleScheme()
}
}
}
Vuetify Theme Configuration
// src/plugins/vuetify.ts
import { createVuetify } from 'vuetify'
import { LightTheme } from '@/theme/LightTheme'
import { DarkTheme } from '@/theme/DarkTheme'
export default createVuetify({
theme: {
defaultTheme: 'light',
themes: {
light: LightTheme,
dark: DarkTheme
},
variations: {
colors: ['primary', 'secondary', 'success', 'info', 'warning', 'error'],
lighten: 5,
darken: 5
}
}
})
Customization Guide
Add New Color Scheme
Add a new color scheme to the colorSchemeStore.ts
// src/stores/colorSchemeStore.ts
export const colorSchemes: ColorScheme[] = [
// ... existing schemes
{
name: 'custom',
displayName: 'Custom',
primary: '#YOUR_PRIMARY_COLOR',
secondary: '#YOUR_SECONDARY_COLOR',
lightprimary: '#YOUR_LIGHT_PRIMARY',
lightsecondary: '#YOUR_LIGHT_SECONDARY'
}
];
Update Dark Mode Colors
Add dark mode color mappings in themeUtils.ts
// src/utils/themeUtils.ts
const darkColorMap: { [key: string]: { lightprimary: string; lightsecondary: string } } = {
// ... existing mappings
custom: {
lightprimary: '#YOUR_DARK_PRIMARY',
lightsecondary: '#YOUR_DARK_SECONDARY'
}
};
Test Your Custom Theme
Run the development server and test your new color scheme
npm run dev
# Use the color scheme in your component:
colorSchemeStore.setColorScheme('custom')
Best Practices
Accessibility
Ensure sufficient contrast ratios for text readability in both themes
Consistency
Use CSS variables consistently across all components and pages
Responsive
Test theme colors across different screen sizes and devices
Performance
Minimize CSS reflows when switching between themes