BookStack icon indicating copy to clipboard operation
BookStack copied to clipboard

Change inline code highlighted text

Open diasdmhub opened this issue 1 year ago • 2 comments

Attempted Debugging

  • [X] I have read the debugging page

Searched GitHub Issues

  • [X] I have searched GitHub for the issue.

Describe the Scenario

Whenever I format a text to inline code and click on it, the text is highlighted and becomes very hard to read. If I select the text, it becomes even harder to read. It sort of takes on a high contrast color.

Unselected inline code text

image

Clicked inline code text

image

Selected inline code text

image


How can I change this highlight color to something easier to read?


Hosting Environment

  • Bookstack v24.02.3
  • Ubuntu 22.04
  • PHP 8.1.2
  • Apache/2.4.52

diasdmhub avatar May 22 '24 21:05 diasdmhub

Hi @diasdmhub, If you want to override the default browser/OS text selection color, you could add the following to your "Custom HTML Head Content" customization setting in BookStack:

<style>
  /* Use a purple background and white text for just code block elements*/
  .page-content code::selection { background: #b86ad3; color: #FFF; }

  /* As above, but for all page content elements*/
  .page-content *::selection { background: #b86ad3; color: #FFF; }
</style>

There are two examples in there, you could choose the one you want and tweak the colors as desired.

ssddanbrown avatar May 23 '24 10:05 ssddanbrown

Thanks @ssddanbrown. The purple background is easier on my eyes.

However, as shown in my clicked example, just clicking on an inline code text will highlight it in blue. Note that it is not a selection, it is just a click or placing the cursor on the inline code text.

bookstack_horrible_code_highlight

My browser does not highlight any code text like this. Only Bookstack's text editor does that. I wish it wouldn't highlight the text like that.

diasdmhub avatar May 23 '24 12:05 diasdmhub

I can confirm in dark mode it is very hard to read. The blue selection seems to come from data-mce-selected="inline-boundary".

FlorinBuffet avatar Feb 25 '25 18:02 FlorinBuffet

I wonder how to edit or override it.

diasdmhub avatar Mar 03 '25 12:03 diasdmhub