Separate tags and value colours

This commit is contained in:
Veronica Berglyd Olsen
2024-04-28 22:43:46 +02:00
parent 22a34be21a
commit 1d438d5d76
8 changed files with 98 additions and 85 deletions
+2 -1
View File
@@ -116,6 +116,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
self._addCharFormat("note", SHARED.theme.colNote)
self._addCharFormat("code", SHARED.theme.colCode)
self._addCharFormat("keyword", SHARED.theme.colKey)
self._addCharFormat("tag", SHARED.theme.colTag)
self._addCharFormat("modifier", SHARED.theme.colMod)
self._addCharFormat("value", SHARED.theme.colVal)
self._addCharFormat("optional", SHARED.theme.colOpt)
@@ -315,7 +316,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
self.setFormat(xPos, xLen, self._hStyles["keyword"])
elif isGood[n] and not self._isInactive:
one, two = index.parseValue(bit)
self.setFormat(xPos, len(one), self._hStyles["value"])
self.setFormat(xPos, len(one), self._hStyles["tag"])
if two:
yPos = xPos + len(bit) - len(two)
self.setFormat(yPos, len(two), self._hStyles["optional"])
+8 -8
View File
@@ -472,21 +472,21 @@ class GuiDocViewer(QTextBrowser):
"""Generate an appropriate style sheet for the document viewer,
based on the current syntax highlighter theme.
"""
colText = cssCol(SHARED.theme.colText)
colHead = cssCol(SHARED.theme.colHead)
colVals = cssCol(SHARED.theme.colVal)
colMark = cssCol(SHARED.theme.colMark)
colKeys = cssCol(SHARED.theme.colKey)
colOpts = cssCol(SHARED.theme.colOpt)
colHide = cssCol(SHARED.theme.colHidden)
colNote = cssCol(SHARED.theme.colNote)
colKeys = cssCol(SHARED.theme.colKey)
colMark = cssCol(SHARED.theme.colMark)
colMods = cssCol(SHARED.theme.colMod)
colNote = cssCol(SHARED.theme.colNote)
colOpts = cssCol(SHARED.theme.colOpt)
colTags = cssCol(SHARED.theme.colTag)
colText = cssCol(SHARED.theme.colText)
self.document().setDefaultStyleSheet(
f"body {{color: {colText};}}\n"
f"h1, h2, h3, h4 {{color: {colHead};}}\n"
f"a {{color: {colVals};}}\n"
f"mark {{background-color: {colMark};}}\n"
f".tags {{color: {colKeys};}}\n"
f".keyword {{color: {colKeys};}}\n"
f".tag {{color: {colTags};}}\n"
f".optional {{color: {colOpts};}}\n"
f".comment {{color: {colHide};}}\n"
f".note {{color: {colNote};}}\n"
+2
View File
@@ -103,6 +103,7 @@ class GuiTheme:
self.colNote = QColor(0, 0, 0)
self.colCode = QColor(0, 0, 0)
self.colKey = QColor(0, 0, 0)
self.colTag = QColor(0, 0, 0)
self.colVal = QColor(0, 0, 0)
self.colOpt = QColor(0, 0, 0)
self.colSpell = QColor(0, 0, 0)
@@ -345,6 +346,7 @@ class GuiTheme:
self.colNote = self._parseColour(confParser, cnfSec, "note")
self.colCode = self._parseColour(confParser, cnfSec, "shortcode")
self.colKey = self._parseColour(confParser, cnfSec, "keyword")
self.colTag = self._parseColour(confParser, cnfSec, "tag")
self.colVal = self._parseColour(confParser, cnfSec, "value")
self.colOpt = self._parseColour(confParser, cnfSec, "optional")
self.colSpell = self._parseColour(confParser, cnfSec, "spellcheckline")