fix(core): should not invert label when its shape text (#10765)
Closes: [BS-2797](https://linear.app/affine-design/issue/BS-2797/在-settings-preview-中,无需对-shape-text-颜色-label-进行反转) Releated: https://github.com/toeverything/AFFiNE/pull/10546
This commit is contained in:
@@ -72,7 +72,8 @@ export const ShapeSettings = () => {
|
|||||||
const { palettes: textColorPalettes, getCurrentColor: getCurrentTextColor } =
|
const { palettes: textColorPalettes, getCurrentColor: getCurrentTextColor } =
|
||||||
usePalettes(
|
usePalettes(
|
||||||
DefaultTheme.ShapeTextColorShortPalettes,
|
DefaultTheme.ShapeTextColorShortPalettes,
|
||||||
DefaultTheme.shapeTextColor
|
DefaultTheme.shapeTextColor,
|
||||||
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
const [currentShape, setCurrentShape] = useState<ShapeName>(ShapeType.Rect);
|
const [currentShape, setCurrentShape] = useState<ShapeName>(ShapeType.Rect);
|
||||||
|
|||||||
@@ -17,13 +17,14 @@ export const useResolvedTheme = () => {
|
|||||||
|
|
||||||
export const usePalettes = (
|
export const usePalettes = (
|
||||||
originalPalettes: Palette[],
|
originalPalettes: Palette[],
|
||||||
defaultColor: Color
|
defaultColor: Color,
|
||||||
|
isShapeText = false
|
||||||
) => {
|
) => {
|
||||||
const theme = useResolvedTheme();
|
const theme = useResolvedTheme();
|
||||||
const isDark = theme === ColorScheme.Dark;
|
const isDark = theme === ColorScheme.Dark;
|
||||||
const palettes = originalPalettes.map(({ key, value }) => {
|
const palettes = originalPalettes.map(({ key, value }) => {
|
||||||
// Title needs to be inverted.
|
// Title needs to be inverted.
|
||||||
if (isDark) {
|
if (!isShapeText && isDark) {
|
||||||
if (key === 'Black') {
|
if (key === 'Black') {
|
||||||
key = 'White';
|
key = 'White';
|
||||||
} else if (key === 'White') {
|
} else if (key === 'White') {
|
||||||
|
|||||||
Reference in New Issue
Block a user