Merge branch 'vkbo:main' into add_themes

This commit is contained in:
Myian
2025-07-05 14:03:29 +02:00
committed by GitHub
21 changed files with 824 additions and 54 deletions
+26 -8
View File
@@ -67,20 +67,38 @@ more contributions are listed on the project's Members page.</p>
<li><b>PyEnchant</b> by Dimitri Merejkowsky</li>
</ul>
<h3>Assets</h3>
<h3>Icon Themes</h3>
<p>Some of the assets bundled with novelWriter were adapted from the following sources:</p>
<p>The following icon themes are bundles with novelWriter:</p>
<ul>
<li><b>Material Symbols</b> icons by Google Inc (Apache 2.0)</li>
<li><b>Remix</b> icons by RemixIcon (Apache 2.0)</li>
<li><b>Font Awesome</b> icons by Fonticons Inc (CC BY 4.0)</li>
<li><b>Tomorrow</b> themes by Chris Kempson (MIT License)</li>
<li><b>Owl</b> themes by Sarah Drasner (MIT License)</li>
<li><b>Solarized</b> themes by Ethan Schoonover (MIT License)</li>
<li><b>Cyberpunk Night</b> theme by Anders Lemvigh (CC BY-SA 4.0)</li>
<li><b>Dracula</b> theme by Zeno Rocha (MIT License)</li>
<li><b>Snazzy Light</b> theme by Florian Reuschel (MIT License)</li>
</ul>
<h3>Colour Themes</h3>
<p>Some colour themes included with novelWriter were adapted from the following sources:</p>
<ul>
<li><b>Dracula</b> theme by Zeno Rocha</li>
<li><b>Espresso</b> theme by Sainnhe Park and Antoine Cotten</li>
<li><b>Noctis</b> themes by Liviu Schera, and contributors</li>
<li><b>Owl</b> themes by Sarah Drasner</li>
<li><b>Primer</b> themes by GitHub Inc and Myian</li>
<li><b>Snazzy Light</b> theme by Florian Reuschel</li>
<li><b>Solarized</b> themes by Ethan Schoonover</li>
<li><b>Tango</b> themes by the Tango Desktop Project</li>
<li><b>Tomorrow</b> themes by Chris Kempson</li>
</ul>
<p>Other themes were created for novelWriter:</p>
<ul>
<li><b>Blue Streak</b> themes by Veronica Berglyd Olsen</li>
<li><b>Cyberpunk Night</b> theme by Anders Lemvigh</li>
<li><b>LCARS</b> theme by Veronica Berglyd Olsen</li>
</ul>
<h3>Fonts</h3>
+76
View File
@@ -0,0 +1,76 @@
[Main]
name = Espresso
mode = dark
description = High contrast & vivid color scheme based on Monokai Pro
author = Veronica Berglyd Olsen
credit = Sainnhe Park and Antoine Cotten
url = https://github.com/sainnhe/sonokai
[Base]
base = #2f2726
default = #e5e4e2
faded = #96817b
red = #f86882
orange = #f08d71
yellow = #f0c66f
green = #a6cd77
cyan = #81d0c9
blue = #89a8e0
purple = #9fa0e1
[Project]
root = blue
folder = yellow
file = default
title = green
chapter = red
scene = blue
note = yellow
active = green
inactive = red
disabled = faded
[Palette]
window = base:L125
windowtext = default
base = base
alternatebase = #51403c
text = default
tooltipbase = yellow:L125
tooltiptext = base
button = base
buttontext = default
brighttext = base
highlight = #4e5f80
highlightedtext = default
link = blue
linkvisited = blue
accent = blue
[GUI]
helptext = blue
fadedtext = faded
errortext = red
[Syntax]
background = base
text = default
line = #392e2c
link = blue
headertext = yellow:L125
headertag = faded
emphasis = orange
dialog = yellow
altdialog = orange
note = yellow:L125
hidden = faded
shortcode = green
keyword = red
tag = green
value = orange
optional = yellow
spellcheckline = red
errorline = green
replacetag = cyan
modifier = blue
texthighlight = yellow:108
+108
View File
@@ -0,0 +1,108 @@
[Main]
name = Noctis
mode = dark
description = A dark theme with a well balanced blend of warm and cold medium contrast colors
author = Veronica Berglyd Olsen
credit = Liviu Schera, and contributors
url = https://github.com/liviuschera/noctis
##
# Noctis Lux : themes/noctis.json
##
# colors
# selection.background : #107684 -> Palette.highlight
# sideBar.background : #041d20 -> Palette.window
# editor.background : #052529 -> Base.base
# editor.foreground : #b2cacd -> Base.default
# editor.selectionBackground : #169fb144 -> Syntax.line, Syntax.texthighlight
# textLink.foreground : #40d4e7 -> Palette.link, Syntax.link
# input.background : #052529 -> Palette.button
# input.foreground : #cdd3de -> Palette.buttontext
# notifications.foreground : #cdd3de -> Palette.tooltiptext
# notifications.background : #073940 -> Palette.tooltipbase
##
# tokenColors
# COMMENT : #5b858b -> Base.faded
# TEXT : #b2cacd -> Syntax.text, Syntax.optional
# KEYWORD : #df769b -> Base.red
# VARIABLE : #e4b781 -> Palette.accent
# ANNOTATION : #d67e5c -> Syntax.note, Syntax.emphasis
# CONSTANT : #d5971a -> Base.yellow
# TAG : #e66533 -> Base.orange
# STRING : #49e9a6 -> Syntax.headertext, Palette.accent
# STRINGINTERPOLATED : #16b673 -> Base.green
# NUMBER : #7060eb -> Base.purple
# FUNCTION : #16a3b6 -> Base.cyan
# SUPPORT : #49d6e9 -> Syntax.replacetag
# MISC : #49ace9 -> Base.blue
# INVALID : #e3541c -> GUI.errortext
##
[Base]
base = #052529
default = #b2cacd
faded = #5b858b
red = #df769b
orange = #e66533
yellow = #d5971a
green = #16b673
cyan = #16a3b6
blue = #49ace9
purple = #7060eb
[Project]
root = blue
folder = yellow
file = default
title = green
chapter = red
scene = blue
note = yellow
active = green
inactive = red
disabled = faded
[Palette]
window = #041d20
windowtext = default
base = base
alternatebase = base:L175
text = default
tooltipbase = #073940
tooltiptext = #cdd3de
button = base
buttontext = #cdd3de
brighttext = base
highlight = #107684
highlightedtext = default
link = #40d4e7
linkvisited = blue
accent = #49e9a6
[GUI]
helptext = #e4b781
fadedtext = faded
errortext = #e3541c
[Syntax]
background = base
text = #b2cacd
line = #169fb132
link = #40d4e7
headertext = #49e9a6
headertag = green:D125
emphasis = #d67e5c
dialog = green
altdialog = blue
note = #d67e5c
hidden = faded
shortcode = red
keyword = yellow
tag = blue
value = red:D125
optional = #b2cacd
spellcheckline = red
errorline = green
replacetag = #49d6e9
modifier = red
texthighlight = #169fb144
+108
View File
@@ -0,0 +1,108 @@
[Main]
name = Noctis Lux
mode = light
description = A light theme with a well balanced blend of warm and cold medium contrast colors
author = Veronica Berglyd Olsen
credit = Liviu Schera, and contributors
url = https://github.com/liviuschera/noctis
##
# Noctis Lux : themes/lux.json
##
# colors
# selection.background : #169fb155 -> Palette.highlight
# sideBar.background : #f9f1e1 -> Palette.window
# editor.background : #fef8ec -> Base.base
# editor.foreground : #005661 -> Base.default
# editor.selectionBackground : #ade2eb77 -> Syntax.line, Syntax.texthighlight
# textLink.foreground : #00c6e0 -> Palette.link, Syntax.link
# input.background : #fef8ec -> Palette.button
# input.foreground : #6a7a7c -> Palette.buttontext
# notifications.foreground : #005661 -> Palette.tooltiptext
# notifications.background : #f2edde -> Palette.tooltipbase
##
# tokenColors
# COMMENT : #8ca6a6 -> Base.faded
# TEXT : #004d57 -> Syntax.text, Syntax.optional
# KEYWORD : #ff5792 -> Base.red
# VARIABLE : #fa8900 -> Palette.accent
# ANNOTATION : #b3694d -> Syntax.note, Syntax.emphasis
# CONSTANT : #a88c00 -> Base.yellow
# TAG : #e64100 -> Base.orange
# STRING : #00b368 -> Syntax.headertext, Palette.accent
# STRINGINTERPOLATED : #009456 -> Base.green
# NUMBER : #5842ff -> Base.purple
# FUNCTION : #0095a8 -> Base.cyan
# SUPPORT : #00bdd6 -> Syntax.replacetag
# MISC : #0094f0 -> Base.blue
# INVALID : #ff530f -> GUI.errortext
##
[Base]
base = #fef8ec
default = #005661
faded = #8ca6a6
red = #ff5792
orange = #e64100
yellow = #a88c00
green = #009456
cyan = #0095a8
blue = #0094f0
purple = #5842ff
[Project]
root = blue
folder = yellow
file = default
title = green
chapter = red
scene = blue
note = yellow
active = green
inactive = red
disabled = faded
[Palette]
window = #f9f1e1
windowtext = default
base = base
alternatebase = base:D115
text = default
tooltipbase = #f2edde
tooltiptext = #005661
button = base
buttontext = #6a7a7c
brighttext = base
highlight = #169fb155
highlightedtext = default
link = #00c6e0
linkvisited = blue
accent = #00b368
[GUI]
helptext = #fa8900
fadedtext = faded
errortext = #ff530f
[Syntax]
background = base
text = #004d57
line = #ade2eb56
link = #00c6e0
headertext = #00b368
headertag = green:D125
emphasis = #b3694d
dialog = green
altdialog = blue
note = #b3694d
hidden = faded
shortcode = red
keyword = yellow
tag = blue
value = red:D125
optional = #004d57
spellcheckline = red
errorline = green
replacetag = #00bdd6
modifier = red
texthighlight = #ade2eb77
+8 -6
View File
@@ -708,17 +708,19 @@ class Index:
return 0, 0, 0
def getReferences(self, tHandle: str, sTitle: str | None = None) -> dict[str, list[str]]:
"""Extract all references made in a file, and optionally title
section.
"""Extract all tags and references made in a file, and
optionally title section.
"""
tRefs = {x: [] for x in nwKeyWords.VALID_KEYS}
refs = {x: [] for x in nwKeyWords.VALID_KEYS}
for rTitle, hItem in self._itemIndex.iterItemHeaders(tHandle):
if sTitle is None or sTitle == rTitle:
for aTag, refTypes in hItem.references.items():
for refType in refTypes:
if refType in tRefs:
tRefs[refType].append(self._tagsIndex.tagName(aTag))
return tRefs
if refType in refs:
refs[refType].append(self._tagsIndex.tagName(aTag))
if tag := hItem.tag:
refs[nwKeyWords.TAG_KEY] = [self._tagsIndex.tagName(tag)]
return refs
def getReferenceForHeader(self, tHandle: str, nHead: int, keyClass: str) -> list[str]:
"""Get the display names for a tags class for insertion into a
+9 -3
View File
@@ -342,20 +342,26 @@ class IndexHeading:
##
def getReferences(self) -> dict[str, list[str]]:
"""Extract all references for this heading."""
"""Extract all tags and references for this heading."""
refs = {x: [] for x in nwKeyWords.VALID_KEYS}
for tag, types in self._refs.items():
for keyword in types:
if keyword in refs and (name := self._cache.tags.tagName(tag)):
refs[keyword].append(name)
if name := self._cache.tags.tagName(self._tag):
refs[nwKeyWords.TAG_KEY] = [name]
return refs
def getReferencesByKeyword(self, keyword: str) -> list[str]:
"""Extract all references for this heading."""
refs = []
for tag, types in self._refs.items():
if keyword in types and (name := self._cache.tags.tagName(tag)):
if keyword == nwKeyWords.TAG_KEY:
if name := self._cache.tags.tagName(self._tag):
refs.append(name)
else:
for tag, types in self._refs.items():
if keyword in types and (name := self._cache.tags.tagName(tag)):
refs.append(name)
return refs
##
+18 -16
View File
@@ -893,31 +893,21 @@ class Tokenizer(ABC):
if nBlock[0] != BlockTyp.TEXT:
# Next block is not text, so we add the buffer to blocks
nLines = len(pLines)
cStyle = pLines[0][4]
if firstIndent and not (self._noIndent or cStyle & BlockFmt.ALIGNED):
# If paragraph indentation is enabled, not temporarily
# turned off, and the block is not aligned, we add the
# text indentation flag
cStyle |= BlockFmt.IND_T
tFmt: T_Formats = []
pTxt = ""
cStyle = BlockFmt.NONE
if nLines == 1:
# The paragraph contains a single line, so we just save
# that directly to the blocks list. If justify is
# enabled, and there is no alignment, we apply it.
if doJustify and not cStyle & BlockFmt.ALIGNED:
cStyle |= BlockFmt.JUSTIFY
# The paragraph contains a single line
tFmt = pLines[0][3]
pTxt = pLines[0][2].translate(transMapB)
sBlocks.append((
BlockTyp.TEXT, pLines[0][1], pTxt, pLines[0][3], cStyle
))
cStyle = pLines[0][4]
elif nLines > 1:
# The paragraph contains multiple lines, so we need to
# join them according to the line break policy, and
# recompute all the formatting markers
tTxt = ""
tFmt: T_Formats = []
for aBlock in pLines:
tLen = len(tTxt)
tTxt += f"{aBlock[2]}{lineSep}"
@@ -925,6 +915,18 @@ class Tokenizer(ABC):
cStyle |= aBlock[4]
pTxt = tTxt[:-1].translate(transMapB)
if nLines:
isAligned = cStyle & BlockFmt.ALIGNED
if firstIndent and not (self._noIndent or isAligned):
# If paragraph indentation is enabled, not temporarily
# turned off, and the block is not aligned, we add the
# text indentation flag
cStyle |= BlockFmt.IND_T
if doJustify and not isAligned:
cStyle |= BlockFmt.JUSTIFY
sBlocks.append((
BlockTyp.TEXT, pLines[0][1], pTxt, tFmt, cStyle
))
+1
View File
@@ -593,6 +593,7 @@ class GuiNovelTree(NTreeView):
lines = []
if head := SHARED.project.index.getItemHeading(tHandle, sTitle):
tags = head.getReferences()
appendTags(tags, nwKeyWords.TAG_KEY, lines)
appendTags(tags, nwKeyWords.POV_KEY, lines)
appendTags(tags, nwKeyWords.FOCUS_KEY, lines)
appendTags(tags, nwKeyWords.CHAR_KEY, lines)