# Highlighter Composer Button

**URL:** https://meta.discourse.org/t/highlighter-composer-button/277597
**Category:** Theme component
**Tags:** broken
**Created:** [September 3, 2023, 1:56am UTC](https://meta.discourse.org/t/highlighter-composer-button/277597 "2023-09-03T01:56:39Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [September 3, 2023, 1:56am UTC](https://meta.discourse.org/t/highlighter-composer-button/277597/1 "2023-09-03T01:56:39Z")

</div>

| | | |
| --- | --- | --- |
| ℹ | **Summary** | A Text Highlighter Button for the Discourse Composer Toolbar |
| 👓 | **Preview** | [Video Demo](https://vimeo.com/860540857) |
| 🛠 | **Repository** | [GitHub - denvergeeks/discourse-highlight-wrap-theme-component: A Text Highlighter Button for the Discourse Composer Toolbar · GitHub](https://github.com/denvergeeks/discourse-highlight-wrap-theme-component) |
| ❓ | **Install Guide** | [How to install a theme or theme component](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682) |
| 📖 | **New to Discourse Themes?** | [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) |

Install this theme component

The button looks like a highlighter pen… ![discourse-highlighter-button](https://global.discourse-cdn.com/meta/original/4X/5/a/a/5aa8e9e0c905030fd8c029a7725ce58aa015f1b1.png) It is for the very specific and limited purpose of clicking a button in the composer toolbar to insert `<mark>this</mark>`.

> ℹ Ctrl-H is the keyboard shortcut you can use in lieu of clicking the button.

[![](https://global.discourse-cdn.com/meta/original/4X/0/8/2/0826199301bca62d5fc371b803a33f2668e01545.jpeg "Discourse Composer Highlighter") ](https://vimeo.com/860540857)

In the settings you can override both the Highlighter (background) color an the color of the text in the highlighted portions.

 ![discourse-highlighter-tc-settings](https://global.discourse-cdn.com/meta/original/4X/1/f/e/1fef78f658342249a954f73ed72953975fabeace.png)

Many thanks to @pfaffman and @merefield and @Lilly and @JammyDodger and @Canapin for helping out with this!

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [September 3, 2023, 2:02am UTC](https://meta.discourse.org/t/highlighter-composer-button/277597/2 "2023-09-03T02:02:33Z")

</div>

That’s amazing. Well done 👏🏻 🤩

---

<div class="post-metadata">

### Author: ![fbpbdmin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fbpbdmin/32/300893_2.png) [@fbpbdmin](https://meta.discourse.org/u/fbpbdmin)
#### Post date: [September 3, 2023, 6:56pm UTC](https://meta.discourse.org/t/highlighter-composer-button/277597/3 "2023-09-03T18:56:45Z")

</div>

this is very nice one.

where is the .d-wrap defined ?  
it shows as this color on mine with the default theme… like to have it the highlighter color as in your video, thanks

![image](https://global.discourse-cdn.com/meta/original/4X/e/9/d/e9daf5f3b30c7991128bf3c8a9c3933cec07c674.png)

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [September 3, 2023, 7:14pm UTC](https://meta.discourse.org/t/highlighter-composer-button/277597/4 "2023-09-03T19:14:06Z")

</div>

Looks like it is the --highlight-medium color variable setting in the palette you are using for that theme

> <https://github.com/denvergeeks/discourse-highlight-wrap-theme-component/blob/82f8e5caeb40295a249861b8cddb18e02ee87911/common/common.scss#L1C1-L9C2>

Here is what one of my pallets looks like:

 ![color_palette](https://global.discourse-cdn.com/meta/original/4X/e/c/6/ec651c32e9b099d6b40259d1cc3aa451fa9ae268.png)

This component is using the medium shade of the highlight color. You can see the exact one in your style guide if you have it enabled in admin-settings-(styleguide enabled or styleguide admin only) the style guide for the theme’s colors is at `/styleguide/atoms/colors`

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [September 3, 2023, 7:22pm UTC](https://meta.discourse.org/t/highlighter-composer-button/277597/5 "2023-09-03T19:22:44Z")

</div>

Actually might be worth putting a PR or suggestion for a highlighter color override. 🙂

---

<div class="post-metadata">

### Author: ![fbpbdmin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fbpbdmin/32/300893_2.png) [@fbpbdmin](https://meta.discourse.org/u/fbpbdmin)
#### Post date: [September 3, 2023, 7:23pm UTC](https://meta.discourse.org/t/highlighter-composer-button/277597/6 "2023-09-03T19:23:18Z")

</div>

yes, was thinking, better to have a setting for it

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [September 3, 2023, 7:24pm UTC](https://meta.discourse.org/t/highlighter-composer-button/277597/7 "2023-09-03T19:24:14Z")

</div>

Adding a setting now… brb

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [September 3, 2023, 7:31pm UTC](https://meta.discourse.org/t/highlighter-composer-button/277597/8 "2023-09-03T19:31:37Z")

</div>

Would using mark be more expected? I think that uses the ‘highlight’ colour in the colour palette.

`<mark>mark</mark>`

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [September 3, 2023, 7:40pm UTC](https://meta.discourse.org/t/highlighter-composer-button/277597/9 "2023-09-03T19:40:21Z")

</div>

OK I put a setting in there to default to #ff8.

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [September 3, 2023, 7:42pm UTC](https://meta.discourse.org/t/highlighter-composer-button/277597/10 "2023-09-03T19:42:29Z")

</div>

Hah I was about to submit a pr to you 🙂

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [September 3, 2023, 7:44pm UTC](https://meta.discourse.org/t/highlighter-composer-button/277597/11 "2023-09-03T19:44:43Z")

</div>

![Happy Super Hero Girls GIF by DC](https://global.discourse-cdn.com/meta/original/4X/4/9/3/493eaa4a1f74ff09bd1590e11441c46012e3f626.webp)

---

<div class="post-metadata">

### Author: ![fbpbdmin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fbpbdmin/32/300893_2.png) [@fbpbdmin](https://meta.discourse.org/u/fbpbdmin)
#### Post date: [September 3, 2023, 7:58pm UTC](https://meta.discourse.org/t/highlighter-composer-button/277597/12 "2023-09-03T19:58:19Z")

</div>

nice, just pulled, it works great ! 😀

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [September 4, 2023, 9:34am UTC](https://meta.discourse.org/t/highlighter-composer-button/277597/13 "2023-09-04T09:34:05Z")

</div>

Hi @denvergeeks 🙂

Here’s how your style differs (with default settings) from `<mark>` (which uses a Discourse’s colors variable, making it readable whatever color scheme you chose):

 ![image](https://global.discourse-cdn.com/meta/original/4X/9/c/f/9cf0a9db48f5a0ede7d7f9619741bd9f6e04bd8c.png)

On a dark theme:

 ![image](https://global.discourse-cdn.com/meta/original/4X/c/8/7/c877db800e51fbbc0563cd623e0dfc6521b2b209.png)

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [September 4, 2023, 6:53pm UTC](https://meta.discourse.org/t/highlighter-composer-button/277597/14 "2023-09-04T18:53:27Z")

</div>

Perfect @Canapin, I’ll roll that in!

Or, if anyone wants to QPR that, let me know as I may not get to it today.

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [September 5, 2023, 4:41am UTC](https://meta.discourse.org/t/highlighter-composer-button/277597/15 "2023-09-05T04:41:21Z")

</div>

OK this now uses @Canapin’s suggestion to use the built-in `<mark>` and corresponding CSS defaults.

Also it now provides settings to override both the Highlighter (background) color and the color of the text in the highlighted portions. Thanks to @Lilly for that conditional CSS.

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [September 5, 2023, 4:58am UTC](https://meta.discourse.org/t/highlighter-composer-button/277597/16 "2023-09-05T04:58:36Z")

</div>

I’m trying to build a json color picker but it’s not working. I just get a blank pop up with a save button. 🤦🏻‍♀️  
Maybe I’ll see if a javascript one is possible somehow. The color palette and badge interface have color-picker js functions, but maybe would only work with a plugin.

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [September 5, 2023, 6:15am UTC](https://meta.discourse.org/t/highlighter-composer-button/277597/17 "2023-09-05T06:15:33Z")

</div>

> [@denvergeeks](#):
>
> override both

For me those settings aren’t overrides. Those must be filled, otherwise it doesn’t do anything.

And… I`m on default theme and because of lack of morning coffee I’m in slow mode — I didn’t check if that comes from theme itself.

Edit: nope, theme or color scheme doesn’t play any roll. So, will it follow color scheme and be an override, or is it a mandatory setting?

---

<div class="post-metadata">

### Author: ![denvergeeks](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denvergeeks/32/327671_2.png) [@denvergeeks](https://meta.discourse.org/u/denvergeeks)
#### Post date: [September 5, 2023, 6:24am UTC](https://meta.discourse.org/t/highlighter-composer-button/277597/18 "2023-09-05T06:24:00Z")

</div>

Try updating the component and refresh the page. I can’t reproduce the error.

Is it inserting the `<mark></mark>` tag?

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [September 5, 2023, 6:25am UTC](https://meta.discourse.org/t/highlighter-composer-button/277597/19 "2023-09-05T06:25:32Z")

</div>

I updated it first before trying. And no, it uses wrap. So I’m a bit behind?

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [September 5, 2023, 6:26am UTC](https://meta.discourse.org/t/highlighter-composer-button/277597/20 "2023-09-05T06:26:08Z")

</div>

> [@Lilly](#):
>
> Maybe I’ll see if a javascript one is possible somehow.

The color picker JSON setting (in a theme/component) is not working on Discourse, indeed.  
I think good practice would be to use Discourse colors variables in general instead of picking arbitrary colors in a theme or component that won’t blend nicely depending on what other themes and colors users chose.

A user made a color picker for the composer some time ago, but I’m not sure the code was released:

> [@BBcode color tags in a theme](https://meta.discourse.org/t/bbcode-color-tags-in-a-theme/211902/8):
>
> I think I have something cooked up based on the previous work of you guys. Will post a PR this weekend. Still bugs and things to iron out. [qKJ3Qt2RpY]

[Next page](https://meta.discourse.org/t/highlighter-composer-button/277597.md?page=2)
