Limit the list of supported highlight colors (#2522)

* Limit the list of supported highlight colors

* Fix tests: use fixed highlight color values

---------

Co-authored-by: ilyasogonov <sogonov.ilya@customscard.ru>
This commit is contained in:
octoultra
2024-01-12 02:16:15 +02:00
committed by GitHub
parent 6b8e22368b
commit e20bd66663
5 changed files with 59 additions and 29 deletions

View File

@ -36,6 +36,33 @@ export const TextEffect = {
NONE: "none",
} as const;
/*
* http://officeopenxml.com/WPtextShading.php
*
* Limit the list of supported highlight colors
*
* */
export const HighlightColor = {
BLACK: "black",
BLUE: "blue",
CYAN: "cyan",
DARK_BLUE: "darkBlue",
DARK_CYAN: "darkCyan",
DARK_GRAY: "darkGray",
DARK_GREEN: "darkGreen",
DARK_MAGENTA: "darkMagenta",
DARK_RED: "darkRed",
DARK_YELLOW: "darkYellow",
GREEN: "green",
LIGHT_GRAY: "lightGray",
MAGENTA: "magenta",
NONE: "none",
RED: "red",
WHITE: "white",
YELLOW: "yellow",
} as const;
/* eslint-enable */
export interface IRunStylePropertiesOptions {
@ -65,7 +92,7 @@ export interface IRunStylePropertiesOptions {
readonly subScript?: boolean;
readonly superScript?: boolean;
readonly font?: string | IFontOptions | IFontAttributesProperties;
readonly highlight?: string;
readonly highlight?: (typeof HighlightColor)[keyof typeof HighlightColor];
readonly highlightComplexScript?: boolean | string;
readonly characterSpacing?: number;
readonly shading?: IShadingAttributesProperties;