fix(*): 请求明细与画布主题 - 区分非计费下载日志并更新默认网格配色

This commit is contained in:
ddCat
2026-09-01 23:54:41 +08:00
parent 1bbccaedc4
commit 58272e683f
14 changed files with 81 additions and 47 deletions

View File

@@ -4,9 +4,9 @@ export type CanvasBackgroundMode = "dots" | "lines" | "blank";
export const canvasThemes = {
light: {
canvas: {
background: "#edeeee",
dot: "rgba(15,23,42,.20)",
line: "rgba(15,23,42,.15)",
background: "#f0f0f0",
dot: "rgba(0,0,0,.80)",
line: "rgba(0,0,0,.80)",
selectionFill: "rgba(17,17,17,.10)",
},
node: {
@@ -70,9 +70,9 @@ export const canvasThemes = {
},
dark: {
canvas: {
background: "#262626",
dot: "rgba(205,205,205,.28)",
line: "rgba(205,205,205,.28)",
background: "#000000",
dot: "rgba(175,175,175,.80)",
line: "rgba(175,175,175,.80)",
selectionFill: "rgba(255,255,255,.12)",
},
node: {

View File

@@ -27,10 +27,12 @@ export type ResolvedCanvasAppearance = {
grid: string;
};
export const DEFAULT_CANVAS_BACKGROUND_MODE: CanvasBackgroundMode = "dots";
const CANVAS_APPEARANCE_DEFAULT_KEY = "infinite-canvas:canvas-appearance-default";
const HEX_COLOR_PATTERN = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;
const CUSTOM_GRID_COLOR = "#B6B3B3";
const CUSTOM_GRID_OPACITY = 70;
const CUSTOM_GRID_COLOR: Record<CanvasColorTheme, string> = { light: "#000000", dark: "#AFAFAF" };
const CUSTOM_GRID_OPACITY = 80;
export function canvasAppearanceForTheme(theme: CanvasColorTheme, previous?: CanvasAppearance): CanvasAppearance {
return previous?.custom?.baseTheme === theme ? { mode: theme, custom: previous.custom } : { mode: theme };
@@ -43,7 +45,7 @@ export function customCanvasAppearanceFromTheme(theme: CanvasColorTheme): Canvas
baseTheme: theme,
backgroundColor: canvasThemes[theme].canvas.background.toUpperCase(),
backgroundBrightness: 0,
gridColor: CUSTOM_GRID_COLOR,
gridColor: CUSTOM_GRID_COLOR[theme],
gridOpacity: CUSTOM_GRID_OPACITY,
},
};