This document provides a quick overview of the changes made to prepare the vodle application for dark theme support.
All hardcoded color values throughout the application were identified and replaced with CSS variables. This enables future dark theme implementation by simply overriding variable values.
Before (src/app/analysis/analysis.page.ts):
const svgcolors = {
"vodlered": "#d33939",
"vodleblue": "#3465a4",
"vodlegreen": "#62a73b",
"vodledarkgreen": "#4c822e"
}After:
const svgcolors = {
"vodlered": "var(--vodle-red)",
"vodleblue": "var(--vodle-blue)",
"vodlegreen": "var(--vodle-green)",
"vodledarkgreen": "var(--vodle-darkgreen)"
}Before (src/app/explain-approval/explain-approval.page.html):
<polyline points="0 0, 10 3.5, 0 7" fill="#9abcbd"/>
<text x="0" y="-6" fill="#808080">Label</text>
<rect fill="#bce4e5" stroke="none" />
<line stroke="#444444" stroke-width="0.2" />After:
<polyline points="0 0, 10 3.5, 0 7" fill="var(--vodle-dark)"/>
<text x="0" y="-6" fill="var(--vodle-grey)">Label</text>
<rect fill="var(--vodle-light)" stroke="none" />
<line stroke="var(--vodle-border-grey)" stroke-width="0.2" />Before (src/theme/variables.scss):
.ion-color-vodlered {
--ion-color-base: #d33939;
}
:root {
--ion-color-primary: #3465a4;
--ion-color-success: #62a73b;
}After:
:root {
/** vodle custom color variables **/
--vodle-red: #d33939;
--vodle-blue: #3465a4;
--vodle-green: #62a73b;
/* ... 15 more variables ... */
}
.ion-color-vodlered {
--ion-color-base: var(--vodle-red);
}
:root {
--ion-color-primary: var(--vodle-blue);
--ion-color-success: var(--vodle-green);
}- 18 CSS variables created
- 7 HTML template files updated
- 2 TypeScript files updated
- 2 landing page files updated
- 50+ color references replaced
- 0 hardcoded colors remaining in app source
src/theme/variables.scss- Added all CSS variable definitions
src/app/analysis/analysis.page.tssrc/app/explain-approval/explain-approval.page.ts
src/app/explain-approval/explain-approval.page.htmlsrc/app/addoption-dialog/addoption-dialog.page.htmlsrc/app/analysis/analysis.page.htmlsrc/app/delegation-dialog/delegation-dialog.page.htmlsrc/app/draftpoll/draftpoll.page.htmlsrc/app/poll/poll.page.htmlsrc/app/sharedcomponents/expandable/expandable.component.html
src/assets/landing-page/index.htmlsrc/assets/landing-page/index_de.html
- Future-Proof: Easy to add dark theme without touching individual components
- Maintainable: All colors defined in one central location
- Consistent: No accidental color variations from hardcoded values
- Flexible: Can easily adjust colors for accessibility or branding
- Browser-Native: Uses CSS custom properties supported by all modern browsers
Simply add this to src/theme/variables.scss:
@media (prefers-color-scheme: dark) {
:root {
--vodle-red: #ff6b6b;
--vodle-blue: #5c9fd6;
--vodle-green: #7dd87d;
--vodle-darkgreen: #6ba357;
--vodle-light: #3a5a5c;
--vodle-dark: #b8d4d6;
--vodle-medium: #8fb5b7;
--vodle-grey: #b0b0b0;
--vodle-border-grey: #666666;
--vodle-tint: #4a7a7c;
--vodle-highlight: #a8ff70;
--vodle-background-light: #1a1a1a;
--vodle-white-semi: #000000c0;
--vodle-white: #000000ff;
--vodle-landing-circle: #5a9a9c;
}
}All UI elements will automatically adapt to the dark theme!
- ✅ Build completes successfully
- ✅ Production build completes successfully (after fixing pre-existing bug)
- ✅ No TypeScript errors related to color changes
- ✅ All color references are valid CSS variables
- ✅ Application functionality unchanged
During testing, we discovered and fixed a pre-existing TypeScript error in production builds:
- Issue:
environment.prod.tswas missing theno_more_options_time_fractionproperty - Fix: Added
no_more_options_time_fraction: 1/2to production environment configuration - Impact: Production builds now succeed without errors
See COLOR_SYSTEM.md for complete documentation including:
- Full list of CSS variables with descriptions
- Usage examples for HTML, SVG, and TypeScript
- Guidelines for future theme development
- Browser compatibility notes