Add a syntax theme colour entry for text highlighting

This commit is contained in:
Veronica Berglyd Olsen
2024-02-25 16:55:17 +01:00
parent 0566fc38af
commit 23bd5dfc41
16 changed files with 31 additions and 8 deletions
@@ -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
@@ -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
+1
View File
@@ -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
@@ -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
+1
View File
@@ -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
+1
View File
@@ -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
@@ -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
@@ -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
+1
View File
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
+5 -2
View File
@@ -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: "<b>",
self.FMT_B_E: "</b>",
@@ -133,7 +136,7 @@ class ToHtml(Tokenizer):
self.FMT_D_E: "</span>",
self.FMT_U_B: "<u>",
self.FMT_U_E: "</u>",
self.FMT_M_B: "<span style='background-color: yellow;'>",
self.FMT_M_B: f"<span style='background-color: {colMark};'>",
self.FMT_M_E: "</span>",
}
else:
+2
View File
@@ -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