@sumaris-net/ngx-components 21.0.0-rc41 → 21.0.0-rc42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -26472,6 +26472,10 @@ class PlatformService extends StartableService {
|
|
|
26472
26472
|
const logMessage = `Detected {mobile: ${this._mobile}, desktop: ${this._desktop}, cordova: ${this._cordova}, capacitor: ${this._capacitor}, android: ${this._android}, ios: ${this._ios}}`;
|
|
26473
26473
|
console.info('[platform] ' + logMessage);
|
|
26474
26474
|
this._logger?.info('ngOnStart', logMessage);
|
|
26475
|
+
// Apply theme colors from the environment (e.g. 'sumaris.color.primary'), if any.
|
|
26476
|
+
// This must be done now (before waiting for network/config below), so a theme defined
|
|
26477
|
+
// via the ENVIRONMENT token is visible immediately - even when offline/backend is down.
|
|
26478
|
+
await this.applyEnvironmentTheme();
|
|
26475
26479
|
// Configure theme
|
|
26476
26480
|
await this.configureTheme(this._mobile);
|
|
26477
26481
|
// Configure Capacitor plugins
|
|
@@ -26833,6 +26837,28 @@ class PlatformService extends StartableService {
|
|
|
26833
26837
|
}
|
|
26834
26838
|
}
|
|
26835
26839
|
/* -- protected methods -- */
|
|
26840
|
+
async applyEnvironmentTheme() {
|
|
26841
|
+
const properties = this.environment.properties;
|
|
26842
|
+
if (!properties || !Object.keys(properties).length)
|
|
26843
|
+
return; // Skip, if no property override
|
|
26844
|
+
console.info('[platform] Applying theme colors, from environment properties...');
|
|
26845
|
+
await this.updateTheme({
|
|
26846
|
+
colors: {
|
|
26847
|
+
primary: properties[CORE_CONFIG_OPTIONS.COLOR_PRIMARY.key],
|
|
26848
|
+
secondary: properties[CORE_CONFIG_OPTIONS.COLOR_SECONDARY.key],
|
|
26849
|
+
tertiary: properties[CORE_CONFIG_OPTIONS.COLOR_TERTIARY.key],
|
|
26850
|
+
success: properties[CORE_CONFIG_OPTIONS.COLOR_SUCCESS.key],
|
|
26851
|
+
warning: properties[CORE_CONFIG_OPTIONS.COLOR_WARNING.key],
|
|
26852
|
+
accent: properties[CORE_CONFIG_OPTIONS.COLOR_ACCENT.key],
|
|
26853
|
+
danger: properties[CORE_CONFIG_OPTIONS.COLOR_DANGER.key],
|
|
26854
|
+
},
|
|
26855
|
+
vars: {
|
|
26856
|
+
'--app-form-field-background-color': properties[CORE_CONFIG_OPTIONS.FORM_FIELD_BACKGROUND_COLOR.key],
|
|
26857
|
+
'--app-form-field-focus-background-color': properties[CORE_CONFIG_OPTIONS.FORM_FIELD_FOCUS_BACKGROUND_COLOR.key],
|
|
26858
|
+
'--app-form-field-disabled-background-color': properties[CORE_CONFIG_OPTIONS.FORM_FIELD_DISABLED_BACKGROUND_COLOR.key],
|
|
26859
|
+
},
|
|
26860
|
+
});
|
|
26861
|
+
}
|
|
26836
26862
|
async configureTheme(mobile, win = window) {
|
|
26837
26863
|
// Listen for changes to settings dark mode
|
|
26838
26864
|
if (this.environment.allowDarkMode) {
|