# Highlight tool should add class

**URL:** <https://forums.ankiweb.net/t/highlight-tool-should-add-class/50581>\
**Category:** Suggestions\
**Created:** [October 11, 2024, 1:33pm UTC](https://forums.ankiweb.net/t/highlight-tool-should-add-class/50581 "2024-10-11T13:33:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kumarei](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/kumarei/32/20057_2.png) [@kumarei](https://forums.ankiweb.net/u/kumarei)\
**Post date:** [October 11, 2024, 1:33pm UTC](https://forums.ankiweb.net/t/highlight-tool-should-add-class/50581/1 "2024-10-11T13:33:43Z")

</div>

Currently, the Highlight tool just wraps the highlighted text in a span with a set background color. This can cause problems for people who switch between dark and light mode, because the text inside the highlighted section may not be readable after the transition.

I would like the span created by the highlight tool to have a class. This would allow targeting by CSS so that highlighted sections could have different colored text than non-highlighted sections.

This is an imperfect solution, because someone that highlights in many different colors may still have trouble finding a suitable text color, but it would be an improvement for users that only use a single text color.

---

<div class="post-metadata">

**Author:** ![Keks](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/keks/32/20537_2.png) [@Keks](https://forums.ankiweb.net/u/Keks)\
**Post date:** [October 11, 2024, 1:48pm UTC](https://forums.ankiweb.net/t/highlight-tool-should-add-class/50581/2 "2024-10-11T13:48:39Z")

</div>

![](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/4/6/46eb14edfb31445f8370b52f74e84ace8e5f2fd9.png)

> It also allows the addition of user-defined toolbar buttons using HTML. HTML is a powerful language allowing nearly endless customization of your cards. [Our wiki](https://github.com/ankidroid/Anki-Android/wiki/Note-Editor-Toolbar-HTML-Samples) contains common code samples to get you started.

[### Note Formatting Toolbar](https://docs.ankidroid.org/#editingNotes)

If it were in anki desktop it would solve your problem.

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [October 12, 2024, 11:04am UTC](https://forums.ankiweb.net/t/highlight-tool-should-add-class/50581/3 "2024-10-12T11:04:12Z")

</div>

The average user struggles with CSS. I don’t know how we can practically provide this, while also allowing the selection of arbitrary colors.

---

<div class="post-metadata">

**Author:** ![garrettm30](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/garrettm30/32/1268_2.png) [@garrettm30](https://forums.ankiweb.net/u/garrettm30)\
**Post date:** [October 12, 2024, 11:41am UTC](https://forums.ankiweb.net/t/highlight-tool-should-add-class/50581/4 "2024-10-12T11:41:40Z")

</div>

I would suggest adding a class in addition to the local style. That way it could still be selected in CSS if the user chooses to. It might require an !important, depending on the design choice of the user, but at least it would be possible.

And I really like that idea of the custom button. That would stop me from repurposing things like bold for totally unrelated things.
