feat: implement comprehensive theming system

- Add ThemeContext with support for dark, gray, light, and custom themes
- Create theme switching UI in Settings with theme selector
- Add custom color editor for custom theme mode
- Update styles.css with theme-specific CSS variables
- Add theme storage API methods for persistence
- Update syntax highlighting to match selected theme
- Wrap App with ThemeProvider for global theme access

The theming system allows users to switch between predefined themes
or create their own custom theme with live color editing.
This commit is contained in:
Mufeed VH
2025-07-28 15:05:46 +05:30
parent 4ddb6a1995
commit c87d36e118
10 changed files with 809 additions and 192 deletions

View File

@@ -1685,6 +1685,50 @@ export const api = {
}
},
// Theme settings helpers
/**
* Gets a setting from the app_settings table
* @param key - The setting key to retrieve
* @returns Promise resolving to the setting value or null if not found
*/
async getSetting(key: string): Promise<string | null> {
try {
// Use storageReadTable to safely query the app_settings table
const result = await this.storageReadTable('app_settings', 1, 1000);
const setting = result?.data?.find((row: any) => row.key === key);
return setting?.value || null;
} catch (error) {
console.error(`Failed to get setting ${key}:`, error);
return null;
}
},
/**
* Saves a setting to the app_settings table (insert or update)
* @param key - The setting key
* @param value - The setting value
* @returns Promise resolving when the setting is saved
*/
async saveSetting(key: string, value: string): Promise<void> {
try {
// Try to update first
try {
await this.storageUpdateRow(
'app_settings',
{ key },
{ value }
);
} catch (updateError) {
// If update fails (row doesn't exist), insert new row
await this.storageInsertRow('app_settings', { key, value });
}
} catch (error) {
console.error(`Failed to save setting ${key}:`, error);
throw error;
}
},
/**
* Get hooks configuration for a specific scope
* @param scope - The configuration scope: 'user', 'project', or 'local'