Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(core/Sheet/Domain): theme color

eiji-th41984845c21b
diff --git a/packages/core/src/Const/THEME_COLOR_MAP.ts b/packages/core/src/Const/THEME_COLOR_MAP.ts
index 83487bbbae..268dbf4e80 100644
--- a/packages/core/src/Const/THEME_COLOR_MAP.ts
+++ b/packages/core/src/Const/THEME_COLOR_MAP.ts
@@ -1,18 +1,18 @@
import { ThemeColors, ThemeColorType } from '../Enum';
-export const THEME_COLOR_MAP = new Map<string, Map<ThemeColorType, string>>();
-
-const OFFICE = new Map<ThemeColorType, string>();
-OFFICE.set(ThemeColorType.ACCENT1, '#4472C4');
-OFFICE.set(ThemeColorType.ACCENT2, '#ED7D31');
-OFFICE.set(ThemeColorType.ACCENT3, '#A5A5A5');
-OFFICE.set(ThemeColorType.ACCENT4, '#70AD47');
-OFFICE.set(ThemeColorType.ACCENT5, '#5B9BD5');
-OFFICE.set(ThemeColorType.ACCENT6, '#70AD47');
-OFFICE.set(ThemeColorType.DARK1, '#000000');
-OFFICE.set(ThemeColorType.DARK2, '#44546A');
-OFFICE.set(ThemeColorType.LIGHT1, '#FFFFFF');
-OFFICE.set(ThemeColorType.LIGHT2, '#E7E6E6');
-OFFICE.set(ThemeColorType.HYPERLINK, '#0563C1');
-OFFICE.set(ThemeColorType.FOLLOWED_HYPERLINK, '#954F72');
-THEME_COLOR_MAP.set(ThemeColors.OFFICE, OFFICE);
+export const THEME_COLORS = {
+ [ThemeColors.OFFICE]: {
+ [ThemeColorType.ACCENT1]: '#4472C4',
+ [ThemeColorType.ACCENT2]: '#ED7D31',
+ [ThemeColorType.ACCENT3]: '#A5A5A5',
+ [ThemeColorType.ACCENT4]: '#70AD47',
+ [ThemeColorType.ACCENT5]: '#5B9BD5',
+ [ThemeColorType.ACCENT6]: '#70AD47',
+ [ThemeColorType.DARK1]: '#000000',
+ [ThemeColorType.DARK2]: '#44546A',
+ [ThemeColorType.LIGHT1]: '#FFFFFF',
+ [ThemeColorType.LIGHT2]: '#E7E6E6',
+ [ThemeColorType.HYPERLINK]: '#0563C1',
+ [ThemeColorType.FOLLOWED_HYPERLINK]: '#954F72',
+ }
+}
diff --git a/packages/core/src/Sheets/Domain/Color.ts b/packages/core/src/Sheets/Domain/Color.ts
index c739be1e6e..6df2790141 100644
--- a/packages/core/src/Sheets/Domain/Color.ts
+++ b/packages/core/src/Sheets/Domain/Color.ts
@@ -1,7 +1,7 @@
import { ThemeColorType, ColorType, ThemeColors } from '../../Enum';
import { Nullable } from '../../Shared';
import { ColorBuilder } from './ColorBuilder';
-import { THEME_COLOR_MAP } from '../../Const/THEME_COLOR_MAP';
+import { THEME_COLORS } from '../../Const/THEME_COLOR_MAP';
export class Color {
static rgbColorToHexValue(color: RgbColor): string {
@@ -356,7 +356,7 @@ export class ThemeColor extends Color {
}
asRgbColor(): RgbColor {
- const themeColors = THEME_COLOR_MAP.get(this._themeColors);
+ const themeColors = THEME_COLORS[this._themeColors];
if (themeColors == null) {
throw new Error('not find themeColors type');
}