Skip to content

Commit 43c797c

Browse files
committed
chore(editor): update default colors of shape
1 parent 00b2362 commit 43c797c

File tree

7 files changed

+24
-36
lines changed

7 files changed

+24
-36
lines changed

Diff for: blocksuite/affine/model/src/themes/default.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { Palette, Theme } from './types.js';
2-
import { buildPalettes, getColorByKey, pureBlack, pureWhite } from './utils.js';
1+
import type { Palette, Theme } from './types';
2+
import { buildPalettes, getColorByKey, pureBlack, pureWhite } from './utils';
33

44
const Transparent = 'transparent';
55
const White = getColorByKey('edgeless/palette/white');
@@ -78,7 +78,7 @@ const StrokeColorPalettes: Palette[] = [
7878
...buildPalettes(StrokeColorMap),
7979
] as const;
8080

81-
const FillColorMap = { ...Light, Black, White } as const;
81+
const FillColorMap = { ...Medium, Black, White } as const;
8282

8383
const FillColorPalettes: Palette[] = [...buildPalettes(FillColorMap)] as const;
8484

@@ -89,9 +89,11 @@ export const DefaultTheme: Theme = {
8989
white: White,
9090
transparent: Transparent,
9191
textColor: Medium.Blue,
92-
shapeTextColor: Black,
92+
// Custom button should be selected by default,
93+
// add transparent `ff` to distinguish `#000000`.
94+
shapeTextColor: '#000000ff',
9395
shapeStrokeColor: Medium.Yellow,
94-
shapeFillColor: Light.Yellow,
96+
shapeFillColor: Medium.Yellow,
9597
connectorColor: Medium.Grey,
9698
noteBackgrounColor: NoteBackgroundColorMap.White,
9799
Palettes,
@@ -101,4 +103,4 @@ export const DefaultTheme: Theme = {
101103
FillColorPalettes,
102104
NoteBackgroundColorMap,
103105
NoteBackgroundColorPalettes,
104-
} as const;
106+
};

Diff for: blocksuite/affine/model/src/themes/index.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { DefaultTheme } from './default.js';
2-
import type { Theme } from './types.js';
1+
import { DefaultTheme } from './default';
2+
import type { Theme } from './types';
33

4-
export * from './color.js';
5-
export { DefaultTheme } from './default.js';
6-
export * from './types.js';
4+
export * from './color';
5+
export { DefaultTheme } from './default';
6+
export * from './types';
77

88
export const Themes: Record<string, Theme> = {
99
default: DefaultTheme,

Diff for: blocksuite/affine/model/src/themes/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { z } from 'zod';
22

3-
import { ColorSchema } from './color.js';
3+
import { ColorSchema } from './color';
44

55
export const PaletteSchema = z.object({
66
key: z.string(),

Diff for: blocksuite/affine/model/src/themes/utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import {
44
lightThemeV2,
55
} from '@toeverything/theme/v2';
66

7-
import type { Color } from './color.js';
8-
import type { Palette } from './types.js';
7+
import type { Color } from './color';
8+
import type { Palette } from './types';
99

1010
// Converts a color map to color list.
1111
export function buildPalettes(

Diff for: blocksuite/blocks/src/root-block/edgeless/components/panel/color-panel.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,14 @@ export class EdgelessColorPanel extends LitElement {
223223
palette => palette.key,
224224
palette => {
225225
const resolvedColor = resolveColor(palette.value, this.theme);
226+
const activated = isEqual(resolvedColor, resolvedValue);
226227
return html`<edgeless-color-button
227228
class=${classMap({ large: true })}
228229
.label=${palette.key}
229230
.color=${palette.value}
230231
.theme=${this.theme}
231232
.hollowCircle=${this.hollowCircle}
232-
?active=${isEqual(resolvedColor, resolvedValue)}
233+
?active=${activated}
233234
@click=${() => {
234235
this.onSelect(palette);
235236
this.value = resolvedColor;

Diff for: packages/frontend/core/src/desktop/dialogs/setting/general-setting/editor/edgeless/docs/shape.json

+5-20
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@
3232
"e6t9tKz8Sy": {
3333
"index": "a5",
3434
"seed": 338503204,
35-
"color": {
36-
"dark": "#ffffff",
37-
"light": "#000000"
38-
},
35+
"color": "#000000ff",
3936
"fillColor": "#fffbd5",
4037
"filled": true,
4138
"fontFamily": "blocksuite:surface:Inter",
@@ -59,10 +56,7 @@
5956
"F8qB_zDC5Q": {
6057
"index": "a6",
6158
"seed": 1896265661,
62-
"color": {
63-
"dark": "#ffffff",
64-
"light": "#000000"
65-
},
59+
"color": "#000000ff",
6660
"fillColor": "#fffbd5",
6761
"filled": true,
6862
"fontFamily": "blocksuite:surface:Inter",
@@ -86,10 +80,7 @@
8680
"mPR44JBpcd": {
8781
"index": "a7",
8882
"seed": 2073974140,
89-
"color": {
90-
"dark": "#ffffff",
91-
"light": "#000000"
92-
},
83+
"color": "#000000ff",
9384
"fillColor": "#fffbd5",
9485
"filled": true,
9586
"fontFamily": "blocksuite:surface:Inter",
@@ -113,10 +104,7 @@
113104
"cmtluc3FWR": {
114105
"index": "a8",
115106
"seed": 1457248130,
116-
"color": {
117-
"dark": "#ffffff",
118-
"light": "#000000"
119-
},
107+
"color": "#000000ff",
120108
"fillColor": "#fffbd5",
121109
"filled": true,
122110
"fontFamily": "blocksuite:surface:Inter",
@@ -140,10 +128,7 @@
140128
"knt_TKvACR": {
141129
"index": "a9",
142130
"seed": 1896265661,
143-
"color": {
144-
"dark": "#ffffff",
145-
"light": "#000000"
146-
},
131+
"color": "#000000ff",
147132
"fillColor": "#fffbd5",
148133
"filled": true,
149134
"fontFamily": "blocksuite:surface:Inter",

Diff for: packages/frontend/core/src/desktop/dialogs/setting/general-setting/editor/edgeless/shape.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ export const ShapeSettings = () => {
324324
const handler = () => {
325325
editorSetting.set(`shape:${currentShape}`, { color: value });
326326
};
327-
const isSelected = color === value;
327+
const isSelected = isEqual(color, value);
328328
return (
329329
<MenuItem
330330
key={key}

0 commit comments

Comments
 (0)