Skip to content

Commit

Permalink
Use new API when switching themes (stream-labs#4348)
Browse files Browse the repository at this point in the history
* Use new API when switching themes

* Run on app startup
  • Loading branch information
gettinToasty authored Oct 28, 2022
1 parent d6d271d commit 7ca4a83
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/services/customization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { UsageStatisticsService } from 'services/usage-statistics';
import fs from 'fs-extra';
import path from 'path';
import { AppService } from './app';
import * as obs from '../../obs-api';

// Maps to --background
const THEME_BACKGROUNDS = {
Expand Down Expand Up @@ -165,6 +166,7 @@ export class CustomizationService extends PersistentStatefulService<ICustomizati
this.setSettings(this.runMigrations(this.state, CustomizationService.migrations));
this.setLiveDockCollapsed(true); // livedock is always collapsed on app start
this.ensureCrashDumpFolder();
this.setObsTheme();

this.userService.userLoginFinished.subscribe(() => this.setInitialLegacyAlertboxState());

Expand Down Expand Up @@ -203,6 +205,7 @@ export class CustomizationService extends PersistentStatefulService<ICustomizati
}

setTheme(theme: string) {
obs.NodeObs.OBS_content_setDayTheme(['day-theme', 'prime-light'].includes(theme));
return this.setSettings({ theme });
}

Expand Down Expand Up @@ -250,6 +253,10 @@ export class CustomizationService extends PersistentStatefulService<ICustomizati
this.setSettings({ performanceMode: !this.state.performanceMode });
}

setObsTheme() {
obs.NodeObs.OBS_content_setDayTheme(!this.isDarkTheme);
}

get themeOptions() {
const options = [
{ value: 'night-theme', label: $t('Night') },
Expand Down

0 comments on commit 7ca4a83

Please sign in to comment.