From 180b1ef7cbfa227998ad87427cbb2650b24b0a8a Mon Sep 17 00:00:00 2001 From: Alonso Torres Date: Wed, 11 Nov 2026 14:16:20 +0100 Subject: [PATCH] :bug: Fix default theme for penpot plugins (#12982) --- plugins/apps/colors-to-tokens-plugin/src/app/app.component.ts | 4 +++- plugins/apps/contrast-plugin/src/app/app.component.ts | 4 +++- plugins/apps/icons-plugin/src/app/app.component.ts | 4 +++- plugins/apps/lorem-ipsum-plugin/src/app/app.component.ts | 4 +++- plugins/apps/poc-tokens-plugin/src/app/app.component.ts | 4 +++- plugins/apps/rename-layers-plugin/src/app/app.component.ts | 4 +++- plugins/apps/table-plugin/src/app/app.component.ts | 4 +++- 7 files changed, 21 insertions(+), 7 deletions(-) diff --git a/plugins/apps/colors-to-tokens-plugin/src/app/app.component.ts b/plugins/apps/colors-to-tokens-plugin/src/app/app.component.ts index 1e1e204541..b3a4412a00 100644 --- a/plugins/apps/colors-to-tokens-plugin/src/app/app.component.ts +++ b/plugins/apps/colors-to-tokens-plugin/src/app/app.component.ts @@ -72,7 +72,9 @@ export class AppComponent { messages$ = fromEvent>(window, 'message'); initialTheme$ = of( - new URLSearchParams(window.location.search).get('theme'), + // The theme arrives in the query string or in the query part of the hash. + new URLSearchParams(window.location.search).get('theme') ?? + new URLSearchParams(window.location.hash.split('?')[1]).get('theme'), ).pipe(filter((theme) => !!theme)); theme = toSignal( diff --git a/plugins/apps/contrast-plugin/src/app/app.component.ts b/plugins/apps/contrast-plugin/src/app/app.component.ts index 6c4e9263bf..5866d08f2d 100644 --- a/plugins/apps/contrast-plugin/src/app/app.component.ts +++ b/plugins/apps/contrast-plugin/src/app/app.component.ts @@ -115,7 +115,9 @@ export class AppComponent { #messages$ = fromEvent>(window, 'message'); #initialTheme$ = of( - new URLSearchParams(window.location.search).get('theme'), + // The theme arrives in the query string or in the query part of the hash. + new URLSearchParams(window.location.search).get('theme') ?? + new URLSearchParams(window.location.hash.split('?')[1]).get('theme'), ).pipe(filter((theme) => !!theme)); selection = toSignal( diff --git a/plugins/apps/icons-plugin/src/app/app.component.ts b/plugins/apps/icons-plugin/src/app/app.component.ts index ee24b3e356..6ed0f1ce8f 100644 --- a/plugins/apps/icons-plugin/src/app/app.component.ts +++ b/plugins/apps/icons-plugin/src/app/app.component.ts @@ -44,7 +44,9 @@ export class AppComponent { ); public initialTheme$ = of( - new URLSearchParams(window.location.search).get('theme'), + // The theme arrives in the query string or in the query part of the hash. + new URLSearchParams(window.location.search).get('theme') ?? + new URLSearchParams(window.location.hash.split('?')[1]).get('theme'), ).pipe(filter((theme) => !!theme)); public theme = toSignal( diff --git a/plugins/apps/lorem-ipsum-plugin/src/app/app.component.ts b/plugins/apps/lorem-ipsum-plugin/src/app/app.component.ts index 1016cc4a4e..775ffc4986 100644 --- a/plugins/apps/lorem-ipsum-plugin/src/app/app.component.ts +++ b/plugins/apps/lorem-ipsum-plugin/src/app/app.component.ts @@ -69,7 +69,9 @@ export class AppComponent { messages$ = fromEvent>(window, 'message'); initialTheme$ = of( - new URLSearchParams(window.location.search).get('theme'), + // The theme arrives in the query string or in the query part of the hash. + new URLSearchParams(window.location.search).get('theme') ?? + new URLSearchParams(window.location.hash.split('?')[1]).get('theme'), ).pipe(filter((theme) => !!theme)); theme = toSignal( diff --git a/plugins/apps/poc-tokens-plugin/src/app/app.component.ts b/plugins/apps/poc-tokens-plugin/src/app/app.component.ts index 849e890e16..feef780661 100644 --- a/plugins/apps/poc-tokens-plugin/src/app/app.component.ts +++ b/plugins/apps/poc-tokens-plugin/src/app/app.component.ts @@ -44,7 +44,9 @@ export class AppComponent { ); public initialTheme$ = of( - new URLSearchParams(window.location.search).get('theme'), + // The theme arrives in the query string or in the query part of the hash. + new URLSearchParams(window.location.search).get('theme') ?? + new URLSearchParams(window.location.hash.split('?')[1]).get('theme'), ).pipe(filter((theme) => !!theme)); public theme = toSignal( diff --git a/plugins/apps/rename-layers-plugin/src/app/app.component.ts b/plugins/apps/rename-layers-plugin/src/app/app.component.ts index 70055739cc..8f39f284c9 100644 --- a/plugins/apps/rename-layers-plugin/src/app/app.component.ts +++ b/plugins/apps/rename-layers-plugin/src/app/app.component.ts @@ -38,7 +38,9 @@ export class AppComponent { } initialTheme$ = of( - new URLSearchParams(window.location.search).get('theme'), + // The theme arrives in the query string or in the query part of the hash. + new URLSearchParams(window.location.search).get('theme') ?? + new URLSearchParams(window.location.hash.split('?')[1]).get('theme'), ).pipe(filter((theme) => !!theme)); theme = toSignal( diff --git a/plugins/apps/table-plugin/src/app/app.component.ts b/plugins/apps/table-plugin/src/app/app.component.ts index 4cce7de045..ad1e492806 100644 --- a/plugins/apps/table-plugin/src/app/app.component.ts +++ b/plugins/apps/table-plugin/src/app/app.component.ts @@ -40,7 +40,9 @@ export class AppComponent { messages$ = fromEvent>(window, 'message'); initialTheme$ = of( - new URLSearchParams(window.location.search).get('theme'), + // The theme arrives in the query string or in the query part of the hash. + new URLSearchParams(window.location.search).get('theme') ?? + new URLSearchParams(window.location.hash.split('?')[1]).get('theme'), ).pipe(filter((theme) => !!theme)); theme = toSignal(