Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility to customize highlighter color via API #855

Open
MooDySmiles opened this issue Apr 8, 2024 · 3 comments · May be fixed by #889
Open

Possibility to customize highlighter color via API #855

MooDySmiles opened this issue Apr 8, 2024 · 3 comments · May be fixed by #889

Comments

@MooDySmiles
Copy link

MooDySmiles commented Apr 8, 2024

Hi, I would like to customize the color of the highlighter via an API in the D2Reader instance, something akin to a changeHighlighterColor function.

Upon reviewing the code, I didn’t find anything that would allow me to choose a set of colours for text highlighting besides the one that’s hardcoded: the highlight-toolbox-mode-colors div accessible via the colorIcon icon in the toolbox.

My suggestion would be (and I would gladly open a MR myself) to add something like the following in the reader.ts file

const changeHighlighterColor = (color: string) => {
	this.highlighter?.setColor(color);
};

This would address my specific use case. However, further work in the TextHighlighter.ts file could be done to reflect the change of the highlighter color, and subsequently, the color which the highlightIcon, underlineIcon and noteIcon in the TextHighlighter.ts file are painted.

@aferditamuriqi
Copy link
Member

@MooDySmiles you can already change the highlighter color to other options. Please run the samples and you should see how that is done. if further questions, please provide more details why the extisting options do not work for you

@MooDySmiles
Copy link
Author

@aferditamuriqi what I see from the examples is that I can change the highlight color among a predefined set of colors (shown in the image attached and defined in the initializeToolbox function in the TextHighlighter.ts file), which I would like to override with a set of colors decided by me

Screenshot 2024-04-29 alle 14 43 49

I looked for an API which would allow me to reach my goal but didn't find one

@MooDySmiles
Copy link
Author

Any more follow ups?

@MooDySmiles MooDySmiles linked a pull request May 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants