|
| 1 | +import { Link } from 'react-router-dom' |
| 2 | +import '../Docs.css' |
| 3 | + |
| 4 | +export default function CustomThemes() { |
| 5 | + return ( |
| 6 | + <div className="docs-page doc-content"> |
| 7 | + <section className="page-header"> |
| 8 | + <div className="container"> |
| 9 | + <h1>Custom Themes</h1> |
| 10 | + <p>Create and import custom color themes for EasyEdit</p> |
| 11 | + </div> |
| 12 | + </section> |
| 13 | + |
| 14 | + <section className="docs-content"> |
| 15 | + <div className="container"> |
| 16 | + <nav className="doc-breadcrumb"> |
| 17 | + <Link to="/docs">Documentation</Link> / <span>Custom Themes</span> |
| 18 | + </nav> |
| 19 | + |
| 20 | + <div className="doc-section"> |
| 21 | + <h2>Overview</h2> |
| 22 | + <p> |
| 23 | + Themes control all color-related styling in EasyEdit. You can create new themes by |
| 24 | + adding a CSS file that defines the CSS variables used by the application, and then |
| 25 | + import it from the app or select it via File → Themes → Import Theme. |
| 26 | + </p> |
| 27 | + </div> |
| 28 | + |
| 29 | + <div className="doc-section"> |
| 30 | + <h2>Where to put your theme</h2> |
| 31 | + <p> |
| 32 | + For the desktop app use the app's theme importer (File → Themes → Import Theme). For |
| 33 | + the web app (GitHub Pages) themes live under <code>/themes/</code> and are loaded at |
| 34 | + runtime, so add your theme file to <code>public/themes/</code> and ensure it defines |
| 35 | + the required CSS variables. |
| 36 | + </p> |
| 37 | + </div> |
| 38 | + |
| 39 | + <div className="doc-section"> |
| 40 | + <h2>Required variables</h2> |
| 41 | + <p>At minimum, define the following variables in your theme <code>:root</code>:</p> |
| 42 | + <pre><code>{`--bg-root |
| 43 | +--bg-editor |
| 44 | +--bg-preview |
| 45 | +--bg-modal |
| 46 | +--bg-modal-overlay |
| 47 | +--bg-card |
| 48 | +--border-card |
| 49 | +--border-card-light |
| 50 | +--color-text-primary |
| 51 | +--color-text-modal |
| 52 | +--color-text-muted |
| 53 | +--btn-primary-modal |
| 54 | +--btn-primary-modal-text`}</code></pre> |
| 55 | + <p> |
| 56 | + The new <code>--color-text-modal</code> variable is important: it controls text color |
| 57 | + specifically for modal dialogs (About, Features, Password, Import Theme, etc.) and |
| 58 | + ensures readable contrast on modal backgrounds. If you forget to define it, the app |
| 59 | + falls back to <code>--color-text-primary</code>. |
| 60 | + </p> |
| 61 | + </div> |
| 62 | + |
| 63 | + <div className="doc-section"> |
| 64 | + <h2>Example theme</h2> |
| 65 | + <pre><code>{`/* example-theme.css */ |
| 66 | +:root { |
| 67 | + --bg-root: #0f1724; |
| 68 | + --bg-editor: #0b1220; |
| 69 | + --bg-preview: #ffffff; |
| 70 | + --bg-modal: #0c1520; |
| 71 | + --bg-modal-overlay: rgba(0,0,0,0.6); |
| 72 | + --bg-card: rgba(255,255,255,0.03); |
| 73 | + --border-card: rgba(255,255,255,0.08); |
| 74 | + --border-card-light: rgba(255,255,255,0.04); |
| 75 | + --color-text-primary: #e8eef6; |
| 76 | + --color-text-modal: #e8eef6; |
| 77 | + --color-text-muted: #bcd0df; |
| 78 | + --btn-primary-modal: #5aa0f2; |
| 79 | + --btn-primary-modal-text: #ffffff; |
| 80 | +}`}</code></pre> |
| 81 | + </div> |
| 82 | + |
| 83 | + <div className="doc-section"> |
| 84 | + <h2>Importing & activating</h2> |
| 85 | + <ol> |
| 86 | + <li>Open File → Themes → Import Theme</li> |
| 87 | + <li>Paste your theme CSS or upload the file</li> |
| 88 | + <li>Choose the imported theme from the theme selector</li> |
| 89 | + </ol> |
| 90 | + <p> |
| 91 | + For the web app, upload the theme to <code>public/themes/</code> and ensure |
| 92 | + <code>src/main.tsx</code> imports your theme or the app loads it via the theme |
| 93 | + selector (themeLoader will resolve themes using the configured base URL). |
| 94 | + </p> |
| 95 | + </div> |
| 96 | + |
| 97 | + <div className="doc-section"> |
| 98 | + <h2>Tips</h2> |
| 99 | + <ul> |
| 100 | + <li>Set <code>--color-text-modal</code> to a high-contrast color for modal dialogs.</li> |
| 101 | + <li>Test in both dark and light system colour schemes; modals sometimes keep dark |
| 102 | + backgrounds intentionally, so modal text should remain light.</li> |
| 103 | + <li>Use <code>--bg-card</code> and <code>--border-card</code> for badge and card |
| 104 | + backgrounds to maintain consistent contrast inside modals.</li> |
| 105 | + </ul> |
| 106 | + </div> |
| 107 | + |
| 108 | + <div className="doc-nav"> |
| 109 | + <Link to="/docs" className="btn btn-outline">← Back to Documentation</Link> |
| 110 | + </div> |
| 111 | + </div> |
| 112 | + </section> |
| 113 | + </div> |
| 114 | + ) |
| 115 | +} |
0 commit comments