frontend: Improve theme config feature and apply base theme in components

This commit is contained in:
Carlos Santos 2025-09-30 12:06:32 +02:00
parent 0a97f05c58
commit 693de3aa15
2 changed files with 6 additions and 13 deletions

View File

@ -48,6 +48,7 @@ import {
DataPacket_Kind,
OpenViduComponentsUiModule,
OpenViduService,
OpenViduThemeMode,
OpenViduThemeService,
ParticipantLeftEvent,
ParticipantLeftReason,
@ -135,9 +136,10 @@ export class MeetingComponent implements OnInit {
this.features = this.featureConfService.features;
// Change theme variables when custom theme is enabled
effect(async () => {
effect(() => {
if (this.features().hasCustomTheme) {
const theme = this.features().themeConfig;
this.ovThemeService.setTheme(theme!.baseTheme as unknown as OpenViduThemeMode);
this.ovThemeService.updateThemeVariables({
'--ov-primary-action-color': theme?.primaryColor,
'--ov-secondary-action-color': theme?.secondaryColor,

View File

@ -2,6 +2,7 @@ import { computed, Injectable, signal } from '@angular/core';
import {
MeetAppearanceConfig,
MeetRoomConfig,
MeetRoomTheme,
ParticipantPermissions,
ParticipantRole,
RecordingPermissions,
@ -36,12 +37,7 @@ export interface ApplicationFeatures {
// Appearance
hasCustomTheme: boolean;
themeConfig?: {
primaryColor?: string;
secondaryColor?: string;
backgroundColor?: string;
surfaceColor?: string;
};
themeConfig?: MeetRoomTheme;
}
/**
@ -204,12 +200,7 @@ export class FeatureConfigurationService {
features.showThemeSelector = !hasEnabledTheme;
if (hasEnabledTheme) {
features.themeConfig = {
primaryColor: theme.primaryColor,
secondaryColor: theme.secondaryColor,
backgroundColor: theme.backgroundColor,
surfaceColor: theme.surfaceColor
};
features.themeConfig = theme;
}
}