mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-26 02:35:58 +08:00
Closes: [PD-2176](https://linear.app/affine-design/issue/PD-2176/edgeless-shape默认颜色调整) * updates shape's text color to the `#000000ff` and custom button should be selected by default in color picker * updates shape background default color palette to `medium` <img width="727" alt="Screenshot 2025-01-13 at 11 07 14" src="https://github.com/user-attachments/assets/81962741-0dbc-4990-8eec-db5e48624305" /> <img width="444" alt="Screenshot 2025-01-13 at 11 07 09" src="https://github.com/user-attachments/assets/2d119e33-635e-4bd4-826f-e3094c8a3fa2" /> <img width="764" alt="Screenshot 2025-01-13 at 11 08 14" src="https://github.com/user-attachments/assets/09f5c778-0e25-4972-8529-8d8323c27594" />
30 lines
741 B
TypeScript
30 lines
741 B
TypeScript
import {
|
|
type AffineThemeKeyV2,
|
|
darkThemeV2,
|
|
lightThemeV2,
|
|
} from '@toeverything/theme/v2';
|
|
|
|
import type { Color } from './color';
|
|
import type { Palette } from './types';
|
|
|
|
// Converts a color map to color list.
|
|
export function buildPalettes(
|
|
obj: Record<string, Color>,
|
|
prefix = ''
|
|
): Palette[] {
|
|
return Object.entries<Color>(obj).map(([key, value]) => ({
|
|
key: `${prefix}${key}`,
|
|
value,
|
|
}));
|
|
}
|
|
|
|
export function getColorByKey(key: AffineThemeKeyV2): Color {
|
|
const dark = darkThemeV2[key];
|
|
const light = lightThemeV2[key];
|
|
if (dark === light) return dark;
|
|
return { dark, light };
|
|
}
|
|
|
|
export const pureBlack = lightThemeV2['edgeless/palette/black'];
|
|
export const pureWhite = lightThemeV2['edgeless/palette/white'];
|