|
| 1 | +# EasyEdit Theming System |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +EasyEdit now includes a comprehensive theming system that allows you to customize all colors throughout the application. All color-related styles have been extracted into theme files located in `src/themes/`. |
| 6 | + |
| 7 | +## Quick Start |
| 8 | + |
| 9 | +### Using a Different Theme |
| 10 | + |
| 11 | +1. Open `src/main.tsx` |
| 12 | +2. Change the theme import line: |
| 13 | + ```typescript |
| 14 | + // Change from: |
| 15 | + import './themes/default.css'; |
| 16 | + |
| 17 | + // To: |
| 18 | + import './themes/ocean-blue.css'; |
| 19 | + ``` |
| 20 | +3. Restart the development server or rebuild the app |
| 21 | + |
| 22 | +### Available Themes |
| 23 | + |
| 24 | +- **default.css** - Original dark theme with purple/gray gradients |
| 25 | +- **ocean-blue.css** - Cool blue-themed color scheme |
| 26 | + |
| 27 | +## Creating Your Own Theme |
| 28 | + |
| 29 | +1. **Copy an existing theme:** |
| 30 | + ```bash |
| 31 | + cp src/themes/default.css src/themes/my-theme.css |
| 32 | + ``` |
| 33 | + |
| 34 | +2. **Edit the CSS variables** in your new theme file. All color values are defined in the `:root` section. |
| 35 | + |
| 36 | +3. **Update the import** in `src/main.tsx`: |
| 37 | + ```typescript |
| 38 | + import './themes/my-theme.css'; |
| 39 | + ``` |
| 40 | + |
| 41 | +## Theme Structure |
| 42 | + |
| 43 | +All themes use CSS custom properties (variables) organized into categories: |
| 44 | + |
| 45 | +### Color Categories |
| 46 | + |
| 47 | +- **Primary Colors** - Main application backgrounds and borders |
| 48 | +- **Text Colors** - All text throughout the app |
| 49 | +- **Background Colors** - Specific component backgrounds (editor, modals, dropdowns, etc.) |
| 50 | +- **Border Colors** - All border colors |
| 51 | +- **Button Colors** - Gradients and solid colors for all button types |
| 52 | +- **Link Colors** - Hyperlink colors and hover states |
| 53 | +- **Shadow Colors** - Box shadow colors with various opacities |
| 54 | +- **Context Menu** - Right-click menu colors |
| 55 | +- **Focus States** - Focus ring and border colors |
| 56 | + |
| 57 | +### Key Variables to Customize |
| 58 | + |
| 59 | +For a quick theme change, focus on these main variables: |
| 60 | + |
| 61 | +```css |
| 62 | +:root { |
| 63 | + /* Main backgrounds */ |
| 64 | + --color-primary: #242424; |
| 65 | + --bg-editor: #000000; |
| 66 | + |
| 67 | + /* Main text */ |
| 68 | + --color-text-primary: #ffffff; |
| 69 | + |
| 70 | + /* Button gradients */ |
| 71 | + --btn-menu-gradient-start: #374151; |
| 72 | + --btn-menu-gradient-end: #1f2937; |
| 73 | + --btn-mermaid-gradient-start: #667eea; |
| 74 | + --btn-mermaid-gradient-end: #764ba2; |
| 75 | + |
| 76 | + /* Borders */ |
| 77 | + --border-primary: #ccc; |
| 78 | +} |
| 79 | +``` |
| 80 | + |
| 81 | +## What's Themed |
| 82 | + |
| 83 | +The theming system covers: |
| 84 | + |
| 85 | +- ✅ All button colors and gradients |
| 86 | +- ✅ Editor and preview panel backgrounds |
| 87 | +- ✅ Text colors throughout the app |
| 88 | +- ✅ Modal dialogs and overlays |
| 89 | +- ✅ Dropdown menus |
| 90 | +- ✅ Code blocks and inline code |
| 91 | +- ✅ Tables and borders |
| 92 | +- ✅ Input fields |
| 93 | +- ✅ Context menus |
| 94 | +- ✅ Shadows and focus states |
| 95 | + |
| 96 | +## What's NOT Themed |
| 97 | + |
| 98 | +The following remain in component CSS files: |
| 99 | + |
| 100 | +- ❌ Layout and positioning |
| 101 | +- ❌ Spacing (padding, margins) |
| 102 | +- ❌ Font sizes and families |
| 103 | +- ❌ Border radius and widths |
| 104 | +- ❌ Transitions and animations |
| 105 | + |
| 106 | +## Example: Creating a Green Theme |
| 107 | + |
| 108 | +```css |
| 109 | +/* src/themes/forest-green.css */ |
| 110 | +:root { |
| 111 | + --color-primary: #1a2e1a; |
| 112 | + --bg-editor: #0a150a; |
| 113 | + --color-text-primary: #e8f8e8; |
| 114 | + |
| 115 | + --btn-menu-gradient-start: #2e5c2e; |
| 116 | + --btn-menu-gradient-end: #1a3a1a; |
| 117 | + --btn-mermaid-gradient-start: #4a9e4a; |
| 118 | + --btn-mermaid-gradient-end: #2e6c2e; |
| 119 | + |
| 120 | + --border-primary: #4a9e4a; |
| 121 | + /* ... other variables ... */ |
| 122 | +} |
| 123 | +``` |
| 124 | + |
| 125 | +## Tips for Theme Creation |
| 126 | + |
| 127 | +1. **Start with an existing theme** - Copy `default.css` or `ocean-blue.css` as a starting point |
| 128 | +2. **Use a color palette generator** - Tools like coolors.co can help create harmonious color schemes |
| 129 | +3. **Test contrast** - Ensure text is readable against backgrounds (use tools like WebAIM Contrast Checker) |
| 130 | +4. **Consider gradients** - Button gradients should have related colors for smooth transitions |
| 131 | +5. **Test both modes** - Include light mode overrides if needed |
| 132 | +6. **Use opacity for shadows** - rgba() values work best for shadows and overlays |
| 133 | + |
| 134 | +## File Structure |
| 135 | + |
| 136 | +``` |
| 137 | +src/ |
| 138 | +├── themes/ |
| 139 | +│ ├── README.md # Detailed theme documentation |
| 140 | +│ ├── default.css # Default dark theme |
| 141 | +│ └── ocean-blue.css # Example blue theme |
| 142 | +├── main.tsx # Theme import location |
| 143 | +├── App.css # Uses theme variables |
| 144 | +├── index.css # Uses theme variables |
| 145 | +└── components/ |
| 146 | + └── *.css # All use theme variables |
| 147 | +``` |
| 148 | + |
| 149 | +## Contributing Themes |
| 150 | + |
| 151 | +If you create a theme you'd like to share: |
| 152 | + |
| 153 | +1. Place it in `src/themes/` |
| 154 | +2. Follow the naming convention: `theme-name.css` |
| 155 | +3. Include all required CSS variables |
| 156 | +4. Test thoroughly in both light and dark modes |
| 157 | +5. Submit a pull request with your theme |
| 158 | + |
| 159 | +## Troubleshooting |
| 160 | + |
| 161 | +**Theme not applying:** |
| 162 | +- Ensure the import in `main.tsx` is correct |
| 163 | +- Restart the development server |
| 164 | +- Clear browser cache |
| 165 | + |
| 166 | +**Colors look wrong:** |
| 167 | +- Check that all CSS variables are defined |
| 168 | +- Verify variable names match exactly (case-sensitive) |
| 169 | +- Look for typos in color values |
| 170 | + |
| 171 | +**Some elements not themed:** |
| 172 | +- Check if the element uses hardcoded colors in its CSS |
| 173 | +- Report missing theme variables as an issue |
| 174 | + |
| 175 | +## Documentation |
| 176 | + |
| 177 | +For a complete list of all theme variables and their purposes, see `src/themes/README.md`. |
| 178 | + |
| 179 | +## Version |
| 180 | + |
| 181 | +Theme system added in EasyEdit v1.x |
0 commit comments