diff --git a/docs/source/int_customise.rst b/docs/source/int_customise.rst index 7124b3a9..a44e8b75 100644 --- a/docs/source/int_customise.rst +++ b/docs/source/int_customise.rst @@ -179,15 +179,20 @@ A syntax theme ``.conf`` file consists of the following settings: errorline = 0, 0, 0 replacetag = 0, 0, 0 modifier = 0, 0, 0 + texthighlight = 255, 255, 255, 128 In the Main section, you must define at least the ``name`` setting. The Syntax colour values are -RGB numbers of the format ``r, g, b`` where each is an integer from to 255. Omitted values default -to black, except ``background`` which defaults to white, +RGB(A) numbers of the format ``r, g, b, a`` where each is an integer from to 255. The fourth value +is the alpha channel, which can be omitted. + +Omitted syntax colours default to black, except ``background`` which defaults to white, and +``texthighlight`` which defaults to grey. .. versionadded:: 2.2 - The `shortcode` syntax colour entry was added, so you need to update your custom themes if you - made any before version 2.2. + The `shortcode` syntax colour entry was added. .. versionadded:: 2.3 - The `optional` syntax colour entry was added, so you need to update your custom themes if you - made any before version 2.3. + The `optional` syntax colour entry was added. + +.. versionadded:: 2.4 + The `texthighlight` syntax colour entry was added. diff --git a/novelwriter/assets/syntax/default_dark.conf b/novelwriter/assets/syntax/default_dark.conf index 2743b91a..1e4939d9 100644 --- a/novelwriter/assets/syntax/default_dark.conf +++ b/novelwriter/assets/syntax/default_dark.conf @@ -25,3 +25,4 @@ spellcheckline = 200, 46, 0 errorline = 46, 200, 0 replacetag = 0, 184, 46 modifier = 200, 120, 0 +texthighlight = 136, 200, 0, 96 diff --git a/novelwriter/assets/syntax/default_light.conf b/novelwriter/assets/syntax/default_light.conf index eff5c4a8..94619291 100644 --- a/novelwriter/assets/syntax/default_light.conf +++ b/novelwriter/assets/syntax/default_light.conf @@ -25,3 +25,4 @@ spellcheckline = 200, 0, 0 errorline = 0, 150, 0 replacetag = 0, 150, 0 modifier = 150, 110, 30 +texthighlight = 150, 150, 0, 96 diff --git a/novelwriter/assets/syntax/grey_dark.conf b/novelwriter/assets/syntax/grey_dark.conf index b1e2081c..8a71c293 100644 --- a/novelwriter/assets/syntax/grey_dark.conf +++ b/novelwriter/assets/syntax/grey_dark.conf @@ -25,3 +25,4 @@ spellcheckline = 200, 46, 0 errorline = 46, 200, 0 replacetag = 225, 225, 225 modifier = 225, 225, 225 +texthighlight = 255, 255, 255, 64 diff --git a/novelwriter/assets/syntax/grey_light.conf b/novelwriter/assets/syntax/grey_light.conf index 06f43522..879f8f53 100644 --- a/novelwriter/assets/syntax/grey_light.conf +++ b/novelwriter/assets/syntax/grey_light.conf @@ -25,3 +25,4 @@ spellcheckline = 200, 0, 0 errorline = 0, 150, 0 replacetag = 0, 0, 0 modifier = 0, 0, 0 +texthighlight = 0, 0, 0, 64 diff --git a/novelwriter/assets/syntax/light_owl.conf b/novelwriter/assets/syntax/light_owl.conf index 63723094..2704586f 100644 --- a/novelwriter/assets/syntax/light_owl.conf +++ b/novelwriter/assets/syntax/light_owl.conf @@ -45,3 +45,4 @@ spellcheckline = 222, 61, 58 errorline = 8, 145, 106 replacetag = 42, 162, 152 modifier = 224, 175, 5 +texthighlight = 218, 170, 1, 96 diff --git a/novelwriter/assets/syntax/night_owl.conf b/novelwriter/assets/syntax/night_owl.conf index 6d817ef5..b45a2db2 100644 --- a/novelwriter/assets/syntax/night_owl.conf +++ b/novelwriter/assets/syntax/night_owl.conf @@ -45,3 +45,4 @@ spellcheckline = 247, 140, 108 errorline = 173, 219, 103 replacetag = 127, 219, 202 modifier = 236, 196, 141 +texthighlight = 255, 235, 149, 96 diff --git a/novelwriter/assets/syntax/solarized_dark.conf b/novelwriter/assets/syntax/solarized_dark.conf index 9b473923..1108acd2 100644 --- a/novelwriter/assets/syntax/solarized_dark.conf +++ b/novelwriter/assets/syntax/solarized_dark.conf @@ -25,3 +25,4 @@ spellcheckline = 203, 75, 22 errorline = 220, 50, 47 replacetag = 133, 153, 0 modifier = 181, 137, 0 +texthighlight = 181, 137, 0, 96 diff --git a/novelwriter/assets/syntax/solarized_light.conf b/novelwriter/assets/syntax/solarized_light.conf index c94a30fc..daf6cc65 100644 --- a/novelwriter/assets/syntax/solarized_light.conf +++ b/novelwriter/assets/syntax/solarized_light.conf @@ -25,3 +25,4 @@ spellcheckline = 203, 75, 22 errorline = 220, 50, 47 replacetag = 133, 153, 0 modifier = 181, 137, 0 +texthighlight = 181, 137, 0, 96 diff --git a/novelwriter/assets/syntax/tomorrow.conf b/novelwriter/assets/syntax/tomorrow.conf index aa16138a..39826a26 100644 --- a/novelwriter/assets/syntax/tomorrow.conf +++ b/novelwriter/assets/syntax/tomorrow.conf @@ -45,3 +45,4 @@ spellcheckline = 240, 40, 41 errorline = 113, 140, 0 replacetag = 62, 153, 159 modifier = 245, 135, 31 +texthighlight = 234, 183, 0, 96 diff --git a/novelwriter/assets/syntax/tomorrow_night.conf b/novelwriter/assets/syntax/tomorrow_night.conf index af951937..6b5673ed 100644 --- a/novelwriter/assets/syntax/tomorrow_night.conf +++ b/novelwriter/assets/syntax/tomorrow_night.conf @@ -45,3 +45,4 @@ spellcheckline = 204, 102, 102 errorline = 181, 189, 104 replacetag = 138, 190, 183 modifier = 222, 147, 95 +texthighlight = 240, 198, 116, 96 diff --git a/novelwriter/assets/syntax/tomorrow_night_blue.conf b/novelwriter/assets/syntax/tomorrow_night_blue.conf index 939dc146..4b0e19fc 100644 --- a/novelwriter/assets/syntax/tomorrow_night_blue.conf +++ b/novelwriter/assets/syntax/tomorrow_night_blue.conf @@ -45,3 +45,4 @@ spellcheckline = 255, 157, 164 errorline = 209, 241, 169 replacetag = 153, 255, 255 modifier = 255, 197, 143 +texthighlight = 255, 238, 173, 96 diff --git a/novelwriter/assets/syntax/tomorrow_night_bright.conf b/novelwriter/assets/syntax/tomorrow_night_bright.conf index d3005072..30f22216 100644 --- a/novelwriter/assets/syntax/tomorrow_night_bright.conf +++ b/novelwriter/assets/syntax/tomorrow_night_bright.conf @@ -45,3 +45,4 @@ spellcheckline = 213, 78, 83 errorline = 185, 202, 74 replacetag = 112, 192, 177 modifier = 231, 140, 69 +texthighlight = 231, 197, 71, 128 diff --git a/novelwriter/assets/syntax/tomorrow_night_eighties.conf b/novelwriter/assets/syntax/tomorrow_night_eighties.conf index 7773a9df..0b96bf20 100644 --- a/novelwriter/assets/syntax/tomorrow_night_eighties.conf +++ b/novelwriter/assets/syntax/tomorrow_night_eighties.conf @@ -45,3 +45,4 @@ spellcheckline = 242, 119, 122 errorline = 153, 204, 153 replacetag = 102, 204, 204 modifier = 249, 145, 57 +texthighlight = 255, 204, 102, 96 diff --git a/novelwriter/core/tohtml.py b/novelwriter/core/tohtml.py index 2c293070..8137150b 100644 --- a/novelwriter/core/tohtml.py +++ b/novelwriter/core/tohtml.py @@ -29,7 +29,9 @@ import logging from time import time from pathlib import Path -from novelwriter import CONFIG +from PyQt5.QtGui import QColor + +from novelwriter import CONFIG, SHARED from novelwriter.common import formatTimeStamp from novelwriter.constants import nwHeadFmt, nwKeyWords, nwLabels, nwHtmlUnicode from novelwriter.core.project import NWProject @@ -124,6 +126,7 @@ class ToHtml(Tokenizer): def doConvert(self) -> None: """Convert the list of text tokens into an HTML document.""" if self._genMode == self.M_PREVIEW: + colMark = SHARED.theme.colMark.name(QColor.NameFormat.HexArgb) htmlTags = { # HTML4 + CSS2 (for Qt) self.FMT_B_B: "", self.FMT_B_E: "", @@ -133,7 +136,7 @@ class ToHtml(Tokenizer): self.FMT_D_E: "", self.FMT_U_B: "", self.FMT_U_E: "", - self.FMT_M_B: "", + self.FMT_M_B: f"", self.FMT_M_E: "", } else: diff --git a/novelwriter/gui/theme.py b/novelwriter/gui/theme.py index 412a5363..48a0317d 100644 --- a/novelwriter/gui/theme.py +++ b/novelwriter/gui/theme.py @@ -106,6 +106,7 @@ class GuiTheme: self.colError = QColor(0, 0, 0) self.colRepTag = QColor(0, 0, 0) self.colMod = QColor(0, 0, 0) + self.colMark = QColor(255, 255, 255, 128) # Class Setup # =========== @@ -329,6 +330,7 @@ class GuiTheme: self.colError = self._parseColour(confParser, cnfSec, "errorline") self.colRepTag = self._parseColour(confParser, cnfSec, "replacetag") self.colMod = self._parseColour(confParser, cnfSec, "modifier") + self.colMark = self._parseColour(confParser, cnfSec, "texthighlight") return True