From 5d3bfbabff86431f3acae037e8e2ea7afa848410 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 30 Jan 2024 13:18:58 +0800 Subject: [PATCH] :iphone: --- app/src/util/assets.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/util/assets.ts b/app/src/util/assets.ts index 9eb26062c..2046c0d65 100644 --- a/app/src/util/assets.ts +++ b/app/src/util/assets.ts @@ -313,6 +313,9 @@ export const setMode = (modeElementValue: number) => { }; const rgba2hex = (rgba: string) => { + if (rgba.startsWith("#")) { + return rgba; + } let a: any; const rgb: any = rgba.replace(/\s/g, "").match(/^rgba?\((\d+),(\d+),(\d+),?([^,\s)]+)?/i); const alpha = (rgb && rgb[4] || "").trim(); @@ -334,7 +337,7 @@ const rgba2hex = (rgba: string) => { const updateMobileTheme = (OSTheme: string) => { if (isInIOS() || isInAndroid()) { setTimeout(() => { - const backgroundColor = rgba2hex(getComputedStyle(document.body).getPropertyValue("--b3-theme-background").trim().replace(" ", "")); + const backgroundColor = rgba2hex(getComputedStyle(document.body).getPropertyValue("--b3-theme-background").trim()); let mode = window.siyuan.config.appearance.mode; if (window.siyuan.config.appearance.modeOS) { if (OSTheme === "dark") {