# How to change the background colour of selected text in code block?

**URL:** <https://discourse.joplinapp.org/t/how-to-change-the-background-colour-of-selected-text-in-code-block/23514>\
**Category:** Support\
**Created:** [5 February 2022 07:29 UTC](https://discourse.joplinapp.org/t/how-to-change-the-background-colour-of-selected-text-in-code-block/23514 "2022-02-05T07:29:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghostx31](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/ghostx31/32/10265_2.png) [@ghostx31](https://discourse.joplinapp.org/u/ghostx31)\
**Post date:** [5 February 2022 07:29 UTC](https://discourse.joplinapp.org/t/how-to-change-the-background-colour-of-selected-text-in-code-block/23514/1 "2022-02-05T07:29:18Z")

</div>

I have been trying to work around a theme using userchrome.css and userstyle.css. I have been able to change the background of the code block according to my needs but I am unable to change the background colour of selected text in a code block correctly. This is how it appears:

 ![Screenshot from 2022-02-05 12-58-54](https://canada1.discourse-cdn.com/flex028/uploads/cozic/original/2X/c/ce1eb2edffa1faeaa87a878f820f6a03f6e7f4d0.png)

It looks breaky and I did with a hacky workaround. I found that there is a class `.CodeMirror-selected` (from the internal extracted stylesheet) but I am not able to change the colour with it. I came across [this](https://discourse.joplinapp.org/t/how-do-i-change-background-color-of-highlighted-text-in-code-editor/11620) post but this doesn't work since its old and Joplin has changed since then. I haven't been able to find anything for this. Came across [this](https://discourse.joplinapp.org/t/joplin-customization/11195) as well but it doesn't work.

Can anyone point me in the right direction for this?

Using Joplin version 2.6.9-1 on Arch Linux.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex028/uploads/cozic/original/3X/1/c/1c948e33314e232a0927789508474d8624f4270b.png) [@system](https://discourse.joplinapp.org/u/system)\
**Post date:** [7 March 2022 07:30 UTC](https://discourse.joplinapp.org/t/how-to-change-the-background-colour-of-selected-text-in-code-block/23514/2 "2022-03-07T07:30:01Z")

</div>

Closed on 7 March 2022 07:30 UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
