Skip to content

Latest commit

 

History

History
173 lines (138 loc) · 4.66 KB

File metadata and controls

173 lines (138 loc) · 4.66 KB

Summary of Changes for Dark Theme Preparation

This document provides a quick overview of the changes made to prepare the vodle application for dark theme support.

What Was Done

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.

Examples of Changes

1. TypeScript Files

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)"
}

2. HTML/SVG Templates

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" />

3. SCSS Theme Files

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);
}

Statistics

  • 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

Files Modified

Core Files

  • src/theme/variables.scss - Added all CSS variable definitions

TypeScript Files

  • src/app/analysis/analysis.page.ts
  • src/app/explain-approval/explain-approval.page.ts

HTML Templates

  • src/app/explain-approval/explain-approval.page.html
  • src/app/addoption-dialog/addoption-dialog.page.html
  • src/app/analysis/analysis.page.html
  • src/app/delegation-dialog/delegation-dialog.page.html
  • src/app/draftpoll/draftpoll.page.html
  • src/app/poll/poll.page.html
  • src/app/sharedcomponents/expandable/expandable.component.html

Landing Pages

  • src/assets/landing-page/index.html
  • src/assets/landing-page/index_de.html

Benefits

  1. Future-Proof: Easy to add dark theme without touching individual components
  2. Maintainable: All colors defined in one central location
  3. Consistent: No accidental color variations from hardcoded values
  4. Flexible: Can easily adjust colors for accessibility or branding
  5. Browser-Native: Uses CSS custom properties supported by all modern browsers

How to Implement Dark Theme (Future)

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!

Testing

  • ✅ 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

Bug Fix (Bonus)

During testing, we discovered and fixed a pre-existing TypeScript error in production builds:

  • Issue: environment.prod.ts was missing the no_more_options_time_fraction property
  • Fix: Added no_more_options_time_fraction: 1/2 to production environment configuration
  • Impact: Production builds now succeed without errors

Documentation

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