Skip to content

Commit

Permalink
themes
Browse files Browse the repository at this point in the history
  • Loading branch information
acharneski committed Dec 2, 2024
1 parent 10eff60 commit 46d5929
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 10 deletions.
4 changes: 2 additions & 2 deletions webapp/src/store/slices/configSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {AppConfig, ThemeName} from '../../types';

// Helper function to validate theme name
const isValidTheme = (theme: string | null): theme is ThemeName => {
return theme === 'main' || theme === 'night' || theme === 'forest' ||
theme === 'pony' || theme === 'alien';
return theme === 'main' || theme === 'night' || theme === 'forest' ||
theme === 'pony' || theme === 'alien' || theme === 'sunset';
};
// Load theme from localStorage with type safety
const loadSavedTheme = (): ThemeName => {
Expand Down
5 changes: 4 additions & 1 deletion webapp/src/themes/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ const prismThemes: Record<ThemeName, string> = {
night: 'prism-dark',
forest: 'prism-okaidia',
pony: 'prism-twilight',
alien: 'prism-tomorrow'
alien: 'prism-tomorrow',
sunset: 'prism-twilight', // Added missing sunset theme mapping
ocean: 'prism-okaidia', // Added comma
cyberpunk: 'prism-tomorrow' // Added cyberpunk theme mapping
};
// Function to load Prism theme
const loadPrismTheme = async (themeName: ThemeName) => {
Expand Down
7 changes: 4 additions & 3 deletions webapp/src/themes/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import {themes} from './themes';
import { themes } from './themes';
export type { ThemeName } from '../types';

// Enhanced theme logging
const themeCount = Object.keys(themes).length;
console.group('Theme System Initialization');
Expand All @@ -12,5 +14,4 @@ console.table(Object.entries(themes).map(([name, theme]) => ({
console.groupEnd();


export {themes};
export type {ThemeName} from './themes';
export { themes };
73 changes: 70 additions & 3 deletions webapp/src/themes/themes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Define theme names
export type ThemeName = 'main' | 'night' | 'forest' | 'pony' | 'alien';
// Import and re-export ThemeName type
import type { ThemeName } from '../types';
export type { ThemeName };

// Enhanced logger configuration
const logger = {
styles: {
Expand Down Expand Up @@ -384,6 +386,71 @@ export const themes = {
forest: forestTheme,
pony: ponyTheme,
alien: alienTheme,
sunset: {
name: 'sunset',
colors: {
primary: '#FF6B6B',
secondary: '#FFA07A',
background: '#2C3E50',
surface: '#34495E',
text: {
primary: '#ECF0F1',
secondary: '#BDC3C7',
},
border: '#95A5A6',
error: '#E74C3C',
success: '#2ECC71',
warning: '#F1C40F',
info: '#3498DB',
primaryDark: '#E74C3C',
disabled: '#7F8C8D',
},
...baseTheme,
},
ocean: {
name: 'ocean',
colors: {
primary: '#00B4D8',
secondary: '#48CAE4',
background: '#03045E',
surface: '#023E8A',
text: {
primary: '#CAF0F8',
secondary: '#90E0EF',
},
border: '#0077B6',
error: '#FF6B6B',
success: '#2ECC71',
warning: '#FFB703',
info: '#48CAE4',
primaryDark: '#0096C7',
disabled: '#415A77',
hover: '#0077B6'
},
...baseTheme,
},
cyberpunk: {
name: 'cyberpunk',
colors: {
primary: '#FF00FF',
secondary: '#00FFFF',
background: '#0D0221',
surface: '#1A1A2E',
text: {
primary: '#FF00FF',
secondary: '#00FFFF',
},
border: '#FF00FF',
error: '#FF0000',
success: '#00FF00',
warning: '#FFD700',
info: '#00FFFF',
primaryDark: '#CC00CC',
disabled: '#4A4A4A',
hover: '#FF69B4'
},
...baseTheme,
},
};
// Enhanced logging for available themes
logger.log('available', 'all', {
Expand All @@ -398,4 +465,4 @@ export const logThemeChange = (from: ThemeName, to: ThemeName) => {
to,
timestamp: new Date().toISOString()
});
};
};
3 changes: 2 additions & 1 deletion webapp/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Define theme names
export type ThemeName = 'main' | 'night' | 'forest' | 'pony' | 'alien';
export type ThemeName = 'main' | 'night' | 'forest' | 'pony' | 'alien' | 'sunset' | 'ocean' | 'cyberpunk';

// Define log levels
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
// Define TabObservers type
Expand Down

0 comments on commit 46d5929

Please sign in to comment.