Skip to content

Commit

Permalink
Fix styles for theme switching
Browse files Browse the repository at this point in the history
  • Loading branch information
DraTeots committed Oct 30, 2024
1 parent 289e911 commit e013aed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
[active]="darkTheme"
icon="brightness_6"
(click)="setDarkTheme()"
class="theme-button"
>
</app-custom-menu-toggle>
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,16 @@ export class DarkThemeComponent implements OnInit {
this.darkTheme = !this.darkTheme;
const scene = this.eventDisplay.getThreeManager().getSceneManager().getScene();

this.eventDisplay.getUIManager().setDarkTheme(this.darkTheme);

// Switch three.js background
if(scene && this.darkTheme) {
scene.background = this.threeDarkBackground;
} else {
scene.background = this.threeLightBackground;
}

const theme = this.darkTheme ? 'dark' : 'light';
document.documentElement.setAttribute('data-theme', theme);
}
}
6 changes: 3 additions & 3 deletions firebird-ng/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ $light-theme: mat.define-light-theme($colors);
--dat-border-color: #f0f0f0;
}

/* Тёмная тема */
/* Dark theme */
[data-theme='dark'] {
--background-color: #2e2e2e;
--secondary-background-color: #292929;
Expand Down Expand Up @@ -89,7 +89,7 @@ body {
background-color: var(--background-color);
}

/* Стили скроллбара */
/* Scroll bar styles */
::-webkit-scrollbar {
width: 0.3em;
height: 0.3em;
Expand Down Expand Up @@ -136,7 +136,7 @@ body {
}

[data-theme='light'] .theme-button:hover {
bbackground-color: #145d7b;
background-color: #145d7b;
}

select {
Expand Down

0 comments on commit e013aed

Please sign in to comment.