You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Text highlight/inline background color is hardcoded making style changes difficult #49332
Currently when highlighting text and selecting a pre-defined background color, the background color is hardcoded inline.
The text color is added with the relevant class, so why not the background also?
Example with white text on a black background:
This is some <mark style="background-color:#000000" class="has-inline-color has-white-color">highlighted text</mark> here
If a theme defines various styles with different color palettes, upon switching style the hardcoded background colors do not change visually to match the new style, and currently the only way to change the background color is to find each instance and manually change it for all highlighted text.
What is your proposed solution?
Use e.g. has-black-background-color CSS class instead of hardcoding the background color.
Don't know why class was not used but there was comment - #34680 (comment) - from a year ago asking the same question, but it seems to have been missed.
Thanks for reporting this, @Andrew-Starr. The same problem (Highlight saving the background color as an inline hex value instead of the palette class or variable) is tracked in #70025, which already has a PR in progress. I'm closing this one as a duplicate so the discussion stays in one place. Please follow #70025.
Activity
chrismademe commentedon Mar 25, 2023
I ran into this yesterday, can anyone shed any light on why it's an inline style as opposed to a class?
Andrew-Starr commentedon Mar 27, 2023
Don't know why class was not used but there was comment - #34680 (comment) - from a year ago asking the same question, but it seems to have been missed.
youknowriad commentedon Oct 17, 2026
Thanks for reporting this, @Andrew-Starr. The same problem (Highlight saving the background color as an inline hex value instead of the palette class or variable) is tracked in #70025, which already has a PR in progress. I'm closing this one as a duplicate so the discussion stays in one place. Please follow #70025.