Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update syntax themes #1836

Merged
merged 6 commits into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/source/more_customise.rst
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,11 @@ A syntax theme ``.conf`` file consists of the following settings:
straightquotes = 0, 0, 0
doublequotes = 0, 0, 0
singlequotes = 0, 0, 0
note = 0, 0, 0
hidden = 0, 0, 0
shortcode = 0, 0, 0
keyword = 0, 0, 0
tag = 0, 0, 0
value = 0, 0, 0
optional = 0, 0, 0
spellcheckline = 0, 0, 0
Expand All @@ -197,3 +199,6 @@ Omitted syntax colours default to black, except ``background`` which defaults to

.. versionadded:: 2.4
The ``texthighlight`` syntax colour entry was added.

.. versionadded:: 2.5
The ``note`` and ``tag`` syntax colour entries were added.
2 changes: 2 additions & 0 deletions novelwriter/assets/syntax/cyberpunk_night.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ emphasis = 0, 255, 255
straightquotes = 7, 27, 219
doublequotes = 0, 255, 0
singlequotes = 0, 140, 255
note = 150, 150, 150
hidden = 77, 77, 100
shortcode = 255, 255, 0
keyword = 255, 100, 255
tag = 255, 150, 10
value = 255, 150, 10
spellcheckline = 242, 72, 23
errorline = 186, 218, 4
Expand Down
51 changes: 33 additions & 18 deletions novelwriter/assets/syntax/default_dark.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,38 @@ url = https://github.com/vkbo/novelWriter
license = CC BY-SA 4.0
licenseurl = https://creativecommons.org/licenses/by-sa/4.0/

##
# Colours:
# Background = 2a2a2a : 54, 54, 54
# Foreground = cccccc : 204, 204, 204
# Comment = 969696 : 150, 150, 150
# Red = d72837 : 215, 40, 55
# Orange = f99157 : 249, 145, 87
# Yellow = ffff84 : 255, 255, 132
# Green = 99cc99 : 153, 204, 153
# Blue = 288ed7 : 102, 153, 204
# Purple = 8c56d7 : 140, 86, 215
##

[Syntax]
background = 54, 54, 54
text = 199, 207, 208
link = 184, 200, 0
headertext = 0, 155, 200
headertag = 0, 105, 135
emphasis = 200, 120, 0
straightquotes = 200, 46, 0
doublequotes = 184, 200, 0
singlequotes = 136, 200, 0
background = 42, 42, 42
text = 204, 204, 204
link = 102, 153, 204
headertext = 102, 153, 204
headertag = 77, 115, 153
emphasis = 102, 153, 204
straightquotes = 215, 40, 55
doublequotes = 153, 204, 153
singlequotes = 153, 204, 153
note = 255, 255, 216
hidden = 150, 150, 150
shortcode = 0, 155, 200
keyword = 200, 46, 0
value = 184, 200, 0
optional = 0, 155, 200
spellcheckline = 200, 46, 0
errorline = 46, 200, 0
replacetag = 0, 184, 46
modifier = 200, 120, 0
texthighlight = 136, 200, 0, 96
shortcode = 249, 145, 87
keyword = 249, 145, 87
tag = 153, 204, 153
value = 255, 255, 132
optional = 215, 40, 55
spellcheckline = 215, 40, 55
errorline = 153, 204, 153
replacetag = 140, 86, 215
modifier = 249, 145, 87
texthighlight = 255, 255, 96, 96
4 changes: 3 additions & 1 deletion novelwriter/assets/syntax/default_light.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ emphasis = 150, 110, 30
straightquotes = 200, 0, 0
doublequotes = 0, 0, 200
singlequotes = 0, 0, 200
note = 100, 0, 200
hidden = 100, 100, 100
shortcode = 0, 100, 0
keyword = 200, 50, 50
value = 50, 150, 50
tag = 50, 150, 50
value = 0, 0, 200
optional = 0, 100, 0
spellcheckline = 200, 0, 0
errorline = 0, 150, 0
Expand Down
2 changes: 2 additions & 0 deletions novelwriter/assets/syntax/grey_dark.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ emphasis = 200, 200, 200
straightquotes = 200, 200, 200
doublequotes = 200, 200, 200
singlequotes = 200, 200, 200
note = 200, 200, 200
hidden = 150, 150, 150
shortcode = 225, 225, 225
keyword = 225, 225, 225
tag = 200, 200, 200
value = 200, 200, 200
optional = 225, 225, 225
spellcheckline = 200, 46, 0
Expand Down
2 changes: 2 additions & 0 deletions novelwriter/assets/syntax/grey_light.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ emphasis = 20, 20, 20
straightquotes = 20, 20, 20
doublequotes = 20, 20, 20
singlequotes = 20, 20, 20
note = 20, 20, 20
hidden = 100, 100, 100
shortcode = 0, 0, 0
keyword = 0, 0, 0
tag = 20, 20, 20
value = 20, 20, 20
optional = 0, 0, 0
spellcheckline = 200, 0, 0
Expand Down
6 changes: 4 additions & 2 deletions novelwriter/assets/syntax/light_owl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ headertag = 40, 142, 215
emphasis = 224, 175, 5
straightquotes = 222, 61, 58
doublequotes = 8, 145, 106
singlequotes = 255, 235, 149
singlequotes = 218, 170, 1
note = 128, 118, 75
hidden = 152, 159, 177
shortcode = 40, 142, 215
keyword = 222, 61, 58
value = 150, 74, 193
tag = 150, 74, 193
value = 224, 175, 5
optional = 40, 142, 215
spellcheckline = 222, 61, 58
errorline = 8, 145, 106
Expand Down
4 changes: 3 additions & 1 deletion novelwriter/assets/syntax/night_owl.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ emphasis = 236, 196, 141
straightquotes = 247, 140, 108
doublequotes = 173, 219, 103
singlequotes = 255, 235, 149
note = 255, 249, 202
hidden = 99, 119, 119
shortcode = 130, 170, 255
keyword = 247, 140, 108
value = 199, 146, 234
tag = 199, 146, 234
value = 255, 235, 149
optional = 130, 170, 255
spellcheckline = 247, 140, 108
errorline = 173, 219, 103
Expand Down
2 changes: 2 additions & 0 deletions novelwriter/assets/syntax/solarized_dark.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ emphasis = 38, 139, 210
straightquotes = 211, 54, 130
doublequotes = 42, 161, 152
singlequotes = 42, 161, 152
note = 101, 161, 156
hidden = 147, 161, 161
shortcode = 147, 161, 161
keyword = 133, 153, 0
tag = 203, 75, 22
value = 203, 75, 22
optional = 147, 161, 161
spellcheckline = 203, 75, 22
Expand Down
4 changes: 3 additions & 1 deletion novelwriter/assets/syntax/solarized_light.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ link = 38, 139, 210
headertext = 88, 110, 117
headertag = 42, 161, 152
emphasis = 38, 139, 210
straightquotes = 211, 54, 130
straightquotes = 211, 54, 130
doublequotes = 42, 161, 152
singlequotes = 42, 161, 152
note = 27, 102, 96
hidden = 88, 110, 117
shortcode = 88, 110, 117
keyword = 133, 153, 0
tag = 203, 75, 22
value = 203, 75, 22
optional = 88, 110, 117
spellcheckline = 203, 75, 22
Expand Down
4 changes: 3 additions & 1 deletion novelwriter/assets/syntax/tango.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ emphasis = 196, 160, 0
straightquotes = 239, 41, 41
doublequotes = 138, 226, 52
singlequotes = 252, 233, 79
note = 252, 242, 164
hidden = 143, 143, 141
shortcode = 115, 159, 207
keyword = 239, 41, 41
value = 173, 127, 168
tag = 173, 127, 168
value = 239, 41, 41
optional = 115, 159, 207
spellcheckline = 239, 41, 41
errorline = 138, 226, 52
Expand Down
4 changes: 3 additions & 1 deletion novelwriter/assets/syntax/tomorrow.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ emphasis = 245, 135, 31
straightquotes = 240, 40, 41
doublequotes = 113, 140, 0
singlequotes = 234, 183, 0
note = 115, 90, 0
hidden = 142, 144, 140
shortcode = 66, 113, 174
keyword = 240, 40, 41
value = 137, 89, 168
tag = 137, 89, 168
value = 234, 183, 0
optional = 66, 113, 174
spellcheckline = 240, 40, 41
errorline = 113, 140, 0
Expand Down
6 changes: 4 additions & 2 deletions novelwriter/assets/syntax/tomorrow_night.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@ background = 29, 31, 33
text = 197, 200, 198
link = 129, 162, 190
headertext = 129, 162, 190
headertag = 129, 162, 190
headertag = 94, 119, 139
emphasis = 222, 147, 95
straightquotes = 204, 102, 102
doublequotes = 181, 189, 104
singlequotes = 240, 198, 116
note = 240, 219, 178
hidden = 150, 152, 150
shortcode = 129, 162, 190
keyword = 204, 102, 102
value = 178, 148, 187
tag = 178, 148, 187
value = 240, 198, 116
optional = 129, 162, 190
spellcheckline = 204, 102, 102
errorline = 181, 189, 104
Expand Down
6 changes: 4 additions & 2 deletions novelwriter/assets/syntax/tomorrow_night_blue.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@ background = 0, 36, 81
text = 255, 255, 255
link = 187, 218, 255
headertext = 187, 218, 255
headertag = 187, 218, 255
headertag = 140, 164, 191
emphasis = 255, 197, 143
straightquotes = 255, 157, 164
doublequotes = 209, 241, 169
singlequotes = 255, 238, 173
note = 255, 247, 214
hidden = 114, 133, 183
shortcode = 187, 218, 255
keyword = 255, 157, 164
value = 235, 187, 255
tag = 235, 187, 255
value = 255, 238, 173
optional = 187, 218, 255
spellcheckline = 255, 157, 164
errorline = 209, 241, 169
Expand Down
6 changes: 4 additions & 2 deletions novelwriter/assets/syntax/tomorrow_night_bright.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@ background = 0, 0, 0
text = 234, 234, 234
link = 122, 166, 218
headertext = 122, 166, 218
headertag = 122, 166, 218
headertag = 94, 127, 167
emphasis = 231, 140, 69
straightquotes = 213, 78, 83
doublequotes = 185, 202, 74
singlequotes = 231, 197, 71
note = 231, 214, 150
hidden = 150, 152, 150
shortcode = 122, 166, 218
keyword = 213, 78, 83
value = 195, 151, 216
tag = 195, 151, 216
value = 231, 197, 71
optional = 122, 166, 218
spellcheckline = 213, 78, 83
errorline = 185, 202, 74
Expand Down
6 changes: 4 additions & 2 deletions novelwriter/assets/syntax/tomorrow_night_eighties.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@ background = 45, 45, 45
text = 204, 204, 204
link = 102, 153, 204
headertext = 102, 153, 204
headertag = 102, 153, 204
headertag = 76, 115, 153
emphasis = 249, 145, 57
straightquotes = 242, 119, 122
doublequotes = 153, 204, 153
singlequotes = 255, 204, 102
note = 255, 230, 179
hidden = 153, 153, 153
shortcode = 102, 153, 204
keyword = 242, 119, 122
value = 204, 153, 204
tag = 204, 153, 204
value = 255, 204, 102
optional = 102, 153, 204
spellcheckline = 242, 119, 122
errorline = 153, 204, 153
Expand Down
16 changes: 10 additions & 6 deletions novelwriter/core/tohtml.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def getStyleSheet(self) -> list[str]:

styles.append("a {color: rgb(66, 113, 174);}")
styles.append("mark {background: rgb(255, 255, 166);}")
styles.append(".tags {color: rgb(245, 135, 31); font-weight: bold;}")
styles.append(".keyword {color: rgb(245, 135, 31); font-weight: bold;}")
styles.append(".break {text-align: left;}")
styles.append(".synopsis {font-style: italic;}")
styles.append(".comment {font-style: italic; color: rgb(100, 100, 100);}")
Expand Down Expand Up @@ -500,7 +500,7 @@ def _formatSynopsis(self, text: str, synopsis: bool) -> str:
else:
sSynop = self._localLookup("Short Description")
if self._genMode == self.M_PREVIEW:
return f"<p class='comment'><span class='synopsis'>{sSynop}:</span> {text}</p>\n"
return f"<p class='note'><span class='modifier'>{sSynop}:</span> {text}</p>\n"
else:
return f"<p class='synopsis'><strong>{sSynop}:</strong> {text}</p>\n"

Expand All @@ -518,18 +518,22 @@ def _formatKeywords(self, text: str) -> tuple[str, str]:
if not valid or not bits or bits[0] not in nwLabels.KEY_NAME:
return "", ""

result = f"<span class='tags'>{self._localLookup(nwLabels.KEY_NAME[bits[0]])}:</span> "
result = f"<span class='keyword'>{self._localLookup(nwLabels.KEY_NAME[bits[0]])}:</span> "
if len(bits) > 1:
if bits[0] == nwKeyWords.TAG_KEY:
one, two = self._project.index.parseValue(bits[1])
result += f"<a name='tag_{one}'>{one}</a>"
result += f"<a class='tag' name='tag_{one}'>{one}</a>"
if two:
result += f" | <span class='optional'>{two}</a>"
else:
if self._genMode == self.M_PREVIEW:
result += ", ".join(f"<a href='#{bits[0][1:]}={t}'>{t}</a>" for t in bits[1:])
result += ", ".join(
f"<a class='tag' href='#{bits[0][1:]}={t}'>{t}</a>" for t in bits[1:]
)
else:
result += ", ".join(f"<a href='#tag_{t}'>{t}</a>" for t in bits[1:])
result += ", ".join(
f"<a class='tag' href='#tag_{t}'>{t}</a>" for t in bits[1:]
)

return bits[0][1:], result

Expand Down
10 changes: 6 additions & 4 deletions novelwriter/gui/dochighlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@ def initHighlighter(self) -> None:
self._addCharFormat("replace", SHARED.theme.colRepTag)
self._addCharFormat("hidden", SHARED.theme.colHidden)
self._addCharFormat("markup", SHARED.theme.colHidden)
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)
Expand Down Expand Up @@ -314,7 +316,7 @@ def highlightBlock(self, text: str) -> None:
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"])
Expand Down Expand Up @@ -370,11 +372,11 @@ def highlightBlock(self, text: str) -> None:
return # No more processing for these
elif cMod:
self.setFormat(0, cDot, self._hStyles["modifier"])
self.setFormat(cDot, cPos - cDot, self._hStyles["optional"])
self.setFormat(cPos, cLen, self._hStyles["hidden"])
self.setFormat(cDot, cPos - cDot, self._hStyles["value"])
self.setFormat(cPos, cLen, self._hStyles["note"])
else:
self.setFormat(0, cPos, self._hStyles["modifier"])
self.setFormat(cPos, cLen, self._hStyles["hidden"])
self.setFormat(cPos, cLen, self._hStyles["note"])

elif text.startswith("["): # Special Command
self.setCurrentBlockState(BLOCK_TEXT)
Expand Down
Loading