feat: Implement Dark Mode
Added styles and configurations to enable dark mode throughout the application. The dark mode features a deep blue color scheme for primary elements and improved visibility for cursor. Selected option text in mat-select now appears in white for better contrast. This enhancement provides users with the option to switch between light and dark modes seamlessly. Changes: - Added dark mode styles in the theme service - Updated mifosx-theme.scss for dark mode customization - Adjusted cursor visibility in dark mode - Modified selected option text color in mat-select Fixes #2021 Implemented the black-logo image into white-logo-image dynamically
This commit is contained in:
committed by
Jose Alberto Hernandez
parent
fcbbb03acb
commit
ccd6e8dded
@@ -58,6 +58,10 @@
|
||||
<mifosx-notifications-tray fxHide.lt-md></mifosx-notifications-tray>
|
||||
</div>
|
||||
|
||||
<div #themeToggle>
|
||||
<theme-toggle-component></theme-toggle-component>
|
||||
</div>
|
||||
|
||||
<div #appMenu>
|
||||
<button mat-icon-button class="ml-1 img-button" [matMenuTriggerFor]="applicationMenu">
|
||||
<img src="assets/images/user_placeholder.png">
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
<img mat-card-image src="assets/images/mifos_lg-logo.jpg" alt="Mifos X">
|
||||
<img mat-card-image src="assets/images/mifos_lg-logo.png" alt="Mifos X">
|
||||
|
||||
</mat-card>
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import { SearchToolComponent } from './search-tool/search-tool.component';
|
||||
import { KeyboardShortcutsDialogComponent } from './keyboard-shortcuts-dialog/keyboard-shortcuts-dialog.component';
|
||||
import { ServerSelectorComponent } from './server-selector/server-selector.component';
|
||||
import { TenantSelectorComponent } from './tenant-selector/tenant-selector.component';
|
||||
import { ThemeToggleComponent } from '../theme-toggle/theme-toggle.component';
|
||||
|
||||
/** Custom Modules */
|
||||
import { IconsModule } from './icons.module';
|
||||
@@ -98,7 +99,8 @@ import { ViewSavingsAccountingDetailsComponent } from './accounting/view-savings
|
||||
StepperButtonsComponent,
|
||||
GlAccountSelectorComponent,
|
||||
GlAccountDisplayComponent,
|
||||
ViewSavingsAccountingDetailsComponent
|
||||
ViewSavingsAccountingDetailsComponent,
|
||||
ThemeToggleComponent
|
||||
],
|
||||
exports: [
|
||||
FileUploadComponent,
|
||||
@@ -130,6 +132,7 @@ import { ViewSavingsAccountingDetailsComponent } from './accounting/view-savings
|
||||
GlAccountSelectorComponent,
|
||||
GlAccountDisplayComponent,
|
||||
ViewSavingsAccountingDetailsComponent,
|
||||
ThemeToggleComponent,
|
||||
]
|
||||
})
|
||||
export class SharedModule { }
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<button mat-icon-button (click)="toggleTheme()">
|
||||
<mat-icon>{{ isDarkMode ? 'wb_sunny' : 'nights_stay' }}</mat-icon>
|
||||
</button>
|
||||
@@ -0,0 +1,23 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ThemeToggleComponent } from './theme-toggle.component';
|
||||
|
||||
describe('ThemeToggleComponent', () => {
|
||||
let component: ThemeToggleComponent;
|
||||
let fixture: ComponentFixture<ThemeToggleComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ThemeToggleComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ThemeToggleComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,20 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { ThemeService } from '../theme.service';
|
||||
|
||||
@Component({
|
||||
selector: 'theme-toggle-component',
|
||||
templateUrl: './theme-toggle.component.html',
|
||||
styleUrls: ['./theme-toggle.component.scss'],
|
||||
})
|
||||
export class ThemeToggleComponent {
|
||||
isDarkMode: boolean;
|
||||
|
||||
constructor(private themeService: ThemeService) {
|
||||
this.isDarkMode = this.themeService.isDarkMode();
|
||||
}
|
||||
|
||||
toggleTheme() {
|
||||
this.isDarkMode = !this.isDarkMode;
|
||||
this.themeService.setDarkMode(this.isDarkMode);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ThemeService } from './theme.service';
|
||||
|
||||
describe('ThemeService', () => {
|
||||
let service: ThemeService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(ThemeService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,21 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ThemeService {
|
||||
private darkMode = false;
|
||||
|
||||
isDarkMode() {
|
||||
return this.darkMode;
|
||||
}
|
||||
|
||||
setDarkMode(isDarkMode: boolean) {
|
||||
this.darkMode = isDarkMode;
|
||||
if (isDarkMode) {
|
||||
document.body.classList.add('dark-theme');
|
||||
} else {
|
||||
document.body.classList.remove('dark-theme');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user