Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions frontend/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@
<mat-icon *ngIf="!(config.configAsObservable | async).effects.mute">volume_up</mat-icon>
<mat-icon *ngIf="(config.configAsObservable | async).effects.mute">volume_off</mat-icon>
</button>
<button
mat-button
(click)="toggleDarkMode()"
[matTooltip]="darkMode ? 'Switch to light mode' : 'Switch to dark mode'"
>
<mat-icon>{{ darkMode ? 'light_mode' : 'dark_mode' }}</mat-icon>
</button>
</div>

<div *ngIf="!(loggedIn | async)">
Expand Down
17 changes: 14 additions & 3 deletions frontend/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class AppComponent {
loggedIn: Observable<boolean>;
canJudge: Observable<boolean>;
noUi: Observable<boolean>;
darkMode = false;

constructor(
private authenticationService: AuthenticationService,
Expand Down Expand Up @@ -65,11 +66,21 @@ export class AppComponent {
this.loggedIn = this.authenticationService.isLoggedIn;
this.isAdmin = this.authenticationService.user.pipe(map((u) => u?.role === ApiRole.ADMIN));
this.canJudge = this.authenticationService.user.pipe(map((u) => u?.role === ApiRole.ADMIN || u?.role === ApiRole.JUDGE));

this.darkMode = localStorage.getItem('darkMode') !== 'false';
this.applyDarkMode();
}

public toggleDarkMode() {
this.darkMode = !this.darkMode;
localStorage.setItem('darkMode', String(this.darkMode));
this.applyDarkMode();
}

private applyDarkMode() {
document.documentElement.classList.toggle('dark-theme', this.darkMode);
}

/**
*
*/
public toggleMute() {
this.config.config.effects.mute = !this.config.config.effects.mute;
this.LOGGER.fatal("Mute state", this.config.config.effects.mute)
Expand Down
35 changes: 28 additions & 7 deletions frontend/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,55 @@ body {
body {
margin: 0;
font-family: Roboto, 'Helvetica Neue', sans-serif;
background-color: #fffbff;
color: #1c1b1f;
transition: background-color 0.2s ease, color 0.2s ease;
}


// Angular Material 18 syntax
@include mat.elevation-classes();
@include mat.app-background();

$theme: mat.define-theme((
$light-theme: mat.define-theme((
color: (
theme-type: light,
primary: mat.$violet-palette,
tertiary: mat.$green-palette,
)
));

$dark-theme: mat.define-theme((
color: (
theme-type: dark,
primary: mat.$violet-palette,
tertiary: mat.$green-palette,
)
));

:root {
@include mat.all-component-themes($theme);
@include mat.all-component-themes($light-theme);
color-scheme: light;
}

// Manual dark mode toggle — class applied to <html> by AppComponent
.dark-theme {
@include mat.all-component-colors($dark-theme);
color-scheme: dark;

body {
background-color: #1c1b1f;
color: #e6e1e5;
}
}

// Color utility classes
.primary-color {
color: mat.get-theme-color($theme, primary) !important;
color: mat.get-theme-color($light-theme, primary) !important;
}
.accent-color {
color: mat.get-theme-color($theme, tertiary) !important;
color: mat.get-theme-color($light-theme, tertiary) !important;
}
.warn-color {
color: mat.get-theme-color($theme, error) !important;
color: mat.get-theme-color($light-theme, error) !important;
}

.overlay {
Expand Down