diff --git a/apps/desktop/layer/renderer/src/components/common/ShadowDOM.tsx b/apps/desktop/layer/renderer/src/components/common/ShadowDOM.tsx index 09d0b2854..6921015e3 100644 --- a/apps/desktop/layer/renderer/src/components/common/ShadowDOM.tsx +++ b/apps/desktop/layer/renderer/src/components/common/ShadowDOM.tsx @@ -102,9 +102,9 @@ export const ShadowDOM: FC< () => ({ fontFamily: `${uiFont},"SN Pro", system-ui, sans-serif`, "--pointer": usePointerCursor ? "pointer" : "default", - "--fo-a": hexToHslString(getAccentColorValue(accentColor)), + "--fo-a": hexToHslString(getAccentColorValue(accentColor)[dark ? "dark" : "light"]), }), - [uiFont, usePointerCursor, accentColor], + [uiFont, usePointerCursor, accentColor, dark], )} id="shadow-html" data-motion-reduce={reduceMotion} diff --git a/apps/desktop/layer/renderer/src/modules/settings/tabs/apperance.tsx b/apps/desktop/layer/renderer/src/modules/settings/tabs/apperance.tsx index 9c5875cf8..489674914 100644 --- a/apps/desktop/layer/renderer/src/modules/settings/tabs/apperance.tsx +++ b/apps/desktop/layer/renderer/src/modules/settings/tabs/apperance.tsx @@ -575,7 +575,7 @@ const ACCENT_COLORS: AccentColor[] = [ const AccentColorSelector = () => { const { t } = useTranslation("settings") const accentColor = useUISettingKey("accentColor") - + const isDark = useIsDark() return (
@@ -592,7 +592,7 @@ const AccentColorSelector = () => { className="group relative flex size-7 items-center justify-center rounded-full transition-all duration-200 hover:scale-110" onClick={() => setUISetting("accentColor", color)} style={{ - backgroundColor: colorValue, + backgroundColor: colorValue[isDark ? "dark" : "light"], }} > {/* Selection ring */} diff --git a/apps/desktop/layer/renderer/src/providers/setting-sync.tsx b/apps/desktop/layer/renderer/src/providers/setting-sync.tsx index ae3ab53a8..435df2c7a 100644 --- a/apps/desktop/layer/renderer/src/providers/setting-sync.tsx +++ b/apps/desktop/layer/renderer/src/providers/setting-sync.tsx @@ -1,4 +1,5 @@ import { isMobile } from "@follow/components/hooks/useMobile.js" +import { useIsDark } from "@follow/hooks" import { getAccentColorValue } from "@follow/shared/settings/constants" import type { UISettings } from "@follow/shared/settings/interface" import { useUnreadAll } from "@follow/store/unread/hooks" @@ -52,11 +53,15 @@ const useUISettingSync = () => { root.style.fontSize = `${setting.uiTextSize * (mobile ? 1.125 : 1)}px` }, [setting.uiTextSize]) + const isDark = useIsDark() useInsertionEffect(() => { const root = document.documentElement // 21.6 100% 50%; - root.style.setProperty("--fo-a", hexToHslString(getAccentColorValue(setting.accentColor))) - }, [setting.accentColor]) + root.style.setProperty( + "--fo-a", + hexToHslString(getAccentColorValue(setting.accentColor)[isDark ? "dark" : "light"]), + ) + }, [setting.accentColor, isDark]) useInsertionEffect(() => { const root = document.documentElement diff --git a/packages/internal/shared/src/settings/constants.ts b/packages/internal/shared/src/settings/constants.ts index 79c41ec07..a81fe7a7b 100644 --- a/packages/internal/shared/src/settings/constants.ts +++ b/packages/internal/shared/src/settings/constants.ts @@ -1,30 +1,40 @@ import type { AccentColor } from "./interface" -export const getAccentColorValue = (color: AccentColor) => { - switch (color) { - case "blue": { - return "#007AFF" - } - case "green": { - return "#4CD964" - } - case "purple": { - return "#9B36B7" - } - case "pink": { - return "#FF2D55" - } - case "red": { - return "#FF3B30" - } - case "yellow": { - return "#FFCC00" - } - case "gray": { - return "#8E8E93" - } - default: { - return "#FF5C00" // orange - } - } +const ACCENT_COLOR_MAP: Record = { + orange: { + light: "#FF6B35", + dark: "#FF5C00", + }, + blue: { + light: "#007AFF", + dark: "#409CFF", + }, + green: { + light: "#34C759", + dark: "#30E85B", + }, + purple: { + light: "#AF52DE", + dark: "#BF5AF2", + }, + pink: { + light: "#FF2D92", + dark: "#FF69B4", + }, + red: { + light: "#FF3B30", + dark: "#FF6B6B", + }, + yellow: { + light: "#FFD54F", + dark: "#FFD60A", + }, + gray: { + light: "#8E8E93", + dark: "#98989D", + }, +} + +export const getAccentColorValue = (color: AccentColor) => { + return ACCENT_COLOR_MAP[color] }