feat: more highlight colours (#3062)

* feat(highlight): extend types and constants for custom hex colours

* feat(highlight): update colour to support hex strings

* refactor(annotator): update component to accept hex colours

* feat(highlight): add colour picker with max 4 custom colors

* feat(settings): add custom colour editor with limit

* refactor: custom highlight colors can only be modified in settings

---------

Co-authored-by: Huang Xin <chrox.huang@gmail.com>
This commit is contained in:
Mohammed Efaz
2026-01-25 12:52:29 +06:00
committed by GitHub
parent aba9e87fc1
commit c31ece6742
7 changed files with 172 additions and 44 deletions
@@ -2,9 +2,12 @@ import { HIGHLIGHT_COLOR_HEX } from '@/services/constants';
import { HighlightColor } from '@/types/book';
import { SystemSettings } from '@/types/settings';
export const getHighlightColorHex = (settings: SystemSettings, color?: HighlightColor) => {
if (!color) return color;
export const getHighlightColorHex = (
settings: SystemSettings,
color?: HighlightColor,
): string | undefined => {
if (!color) return undefined;
if (color.startsWith('#')) return color;
const customColors = settings.globalReadSettings.customHighlightColors;
return customColors?.[color] ?? HIGHLIGHT_COLOR_HEX[color];
};