From 1bc6e08adadc7f1a71e8324ac4b1bdb04acd7874 Mon Sep 17 00:00:00 2001 From: zihanjian Date: Fri, 27 Jun 2025 16:08:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=93=E5=BF=83=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E5=92=8C=E9=A2=9C=E8=89=B2=E7=B3=BB=E7=BB=9F=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=EF=BC=8C=E7=9B=B4=E6=8E=A5=E4=BB=8ElocalStorage?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E8=87=AA=E5=AE=9A=E4=B9=89=E8=89=B2=E6=9D=BF?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=EF=BC=8C=E6=9B=B4=E6=96=B0=E9=A2=9C=E8=89=B2?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=98=BE=E7=A4=BA=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E6=8F=90=E5=8D=87=E7=94=A8=E6=88=B7=E4=BD=93=E9=AA=8C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/studio/page.tsx | 8 +++++--- src/components/ColorSystemPanel.tsx | 10 +++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/app/studio/page.tsx b/src/app/studio/page.tsx index d844952..cc9edd5 100644 --- a/src/app/studio/page.tsx +++ b/src/app/studio/page.tsx @@ -214,9 +214,11 @@ export default function FocusMode() { const aspectRatio = img.height / img.width; const M = Math.round(N * aspectRatio); // M是纵向(高度),按比例计算 - // 根据自定义色板构建可用颜色 - const activeBeadPalette: PaletteColor[] = Array.from(customPalette) - .map(hex => { + // 根据自定义色板构建可用颜色 - 直接从localStorage读取最新数据 + const savedPalette = localStorage.getItem('customPalette'); + const paletteData = savedPalette ? JSON.parse(savedPalette) : Array.from(getAllHexValues()); + const activeBeadPalette: PaletteColor[] = paletteData + .map((hex: string) => { const rgb = hexToRgb(hex); if (!rgb) return null; return { key: hex, hex, rgb }; diff --git a/src/components/ColorSystemPanel.tsx b/src/components/ColorSystemPanel.tsx index cedcdd3..4713195 100644 --- a/src/components/ColorSystemPanel.tsx +++ b/src/components/ColorSystemPanel.tsx @@ -279,9 +279,13 @@ const ColorSystemPanel: React.FC = ({ {groupKey}
{selectedInGroup}/{groupColors.length} - {selectedInGroup > 0 && ( -
- )} +