Merge branch 'main' into Add-Primer-Dark-theme

This commit is contained in:
Veronica Berglyd Olsen
2025-06-04 15:10:46 +02:00
committed by GitHub
21 changed files with 947 additions and 718 deletions
+19 -19
View File
@@ -19,13 +19,13 @@ blue = #4d4dff
purple = #320064 purple = #320064
[Project] [Project]
root = #4d4dff root = blue
folder = #ffff00 folder = yellow
file = #888888 file = default
title = #00ff00 title = green
chapter = #f24817 chapter = red
scene = #4d4dff scene = blue
note = #ffff00 note = yellow
[Palette] [Palette]
window = #000000 window = #000000
@@ -40,30 +40,30 @@ buttontext = #969696
brighttext = #ffffff brighttext = #ffffff
highlight = #321e50 highlight = #321e50
highlightedtext = #ffffff highlightedtext = #ffffff
link = #4d4dff link = blue
linkvisited = #320050 linkvisited = #320050
[GUI] [GUI]
helptext = #616161 helptext = faded
fadedtext = #616161 fadedtext = faded
errortext = #f24817 errortext = red
[Syntax] [Syntax]
background = #000000 background = #000000
text = #969696 text = #969696
link = #4d4dff link = blue
headertext = #ffffff headertext = #ffffff
headertag = #320064 headertag = purple
emphasis = #00ffff emphasis = cyan
dialog = #00ff00 dialog = green
altdialog = #008cff altdialog = #008cff
note = #969696 note = #969696
hidden = #4d4d64 hidden = #4d4d64
shortcode = #ffff00 shortcode = yellow
keyword = #ff64ff keyword = #ff64ff
tag = #ff960a tag = orange
value = #ff960a value = orange
spellcheckline = #f24817 spellcheckline = red
errorline = #bada04 errorline = #bada04
replacetag = #0000b4 replacetag = #0000b4
modifier = #908eb0 modifier = #908eb0
+25 -25
View File
@@ -36,13 +36,13 @@ blue = #93cff9
purple = #bd93f9 purple = #bd93f9
[Project] [Project]
root = #bd93f9 root = purple
folder = #f1fa8c folder = yellow
file = #e6e6e0 file = default
title = #50fa7b title = green
chapter = #ff5555 chapter = red
scene = #8be9fd scene = cyan
note = #f1fa8c note = yellow
[Palette] [Palette]
window = #44475a window = #44475a
@@ -50,39 +50,39 @@ windowtext = #f8f8f2
base = #282a36 base = #282a36
alternatebase = #333645 alternatebase = #333645
text = #f8f8f2 text = #f8f8f2
tooltipbase = #f1fa8c tooltipbase = yellow
tooltiptext = #282a36 tooltiptext = #282a36
button = #505369 button = #505369
buttontext = #f8f8f2 buttontext = #f8f8f2
brighttext = #44475a brighttext = #44475a
highlight = #a681da highlight = #a681da
highlightedtext = #f8f8f2 highlightedtext = #f8f8f2
link = #8be9fd link = cyan
linkvisited = #8be9fd linkvisited = cyan
[GUI] [GUI]
helptext = #ccacf9 helptext = #ccacf9
fadedtext = #6272a4 fadedtext = faded
errortext = #ff5555 errortext = red
[Syntax] [Syntax]
background = #282a36 background = #282a36
text = #f8f8f2 text = #f8f8f2
link = #ff79c6 link = #ff79c6
headertext = #bd93f9 headertext = purple
headertag = #bd93f9a0 headertag = #bd93f9a0
emphasis = #ffb86c emphasis = orange
dialog = #50fa7b dialog = green
altdialog = #f1fa8c altdialog = yellow
note = #ffcce9 note = #ffcce9
hidden = #6272a4 hidden = faded
shortcode = #8be9fd shortcode = cyan
keyword = #ff79c6 keyword = #ff79c6
tag = #ffb86c tag = orange
value = #ffb86c value = orange
optional = #50fa7b optional = green
spellcheckline = #ff5555 spellcheckline = red
errorline = #50fa7b errorline = green
replacetag = #f1fa8c replacetag = yellow
modifier = #8be9fd modifier = cyan
texthighlight = #f1fa8c60 texthighlight = #f1fa8c60
+4 -4
View File
@@ -14,7 +14,7 @@ licenseurl = https://github.com/sdras/night-owl-vscode-theme/blob/master/LICENSE
## ##
# Colours: # Colours:
# Background = #fbfbfb # Background = #fbfbfb
# Current Line = #e0e0e0 # Current Line = #eaeaea
# Selection = #e0e0e0 # Selection = #e0e0e0
# Foreground = #403f52 # Foreground = #403f52
# Comment = #989fb1 # Comment = #989fb1
@@ -48,16 +48,16 @@ scene = blue
note = yellow note = yellow
[Palette] [Palette]
window = #e0e0e0 window = #eaeaea
windowtext = default windowtext = default
base = #fbfbfb base = #fbfbfb
alternatebase = #e0e0e0 alternatebase = #e0e0e0
text = default text = default
tooltipbase = #ffffc0 tooltipbase = #ffffc0
tooltiptext = #15150d tooltiptext = #15150d
button = #e0e0e0 button = #eaeaea
buttontext = default buttontext = default
brighttext = #e0e0e0 brighttext = #eaeaea
highlight = #3087c6 highlight = #3087c6
highlightedtext = #ffffff highlightedtext = #ffffff
link = blue link = blue
+4 -4
View File
@@ -14,7 +14,7 @@ licenseurl = https://github.com/sdras/night-owl-vscode-theme/blob/master/LICENSE
## ##
# Colours: # Colours:
# Background = #011627 # Background = #011627
# Current Line = #32374d # Current Line = #434652
# Selection = #32374d # Selection = #32374d
# Foreground = #d6deeb # Foreground = #d6deeb
# Comment = #637777 # Comment = #637777
@@ -48,16 +48,16 @@ scene = blue
note = yellow note = yellow
[Palette] [Palette]
window = #32374d window = #434652
windowtext = default windowtext = default
base = #011627 base = #011627
alternatebase = #32374d alternatebase = #32374d
text = default text = default
tooltipbase = #ffffc0 tooltipbase = #ffffc0
tooltiptext = #15150d tooltiptext = #15150d
button = #32374d button = #434652
buttontext = default buttontext = default
brighttext = #32374d brighttext = #434652
highlight = #2c98f7 highlight = #2c98f7
highlightedtext = #ffffff highlightedtext = #ffffff
link = blue link = blue
+32 -32
View File
@@ -32,53 +32,53 @@ blue = #09a1ed
purple = #f767bb purple = #f767bb
[Project] [Project]
root = #09a1ed root = blue
folder = #cf9c00 folder = yellow
file = #545554 file = faded
title = #2dae58 title = green
chapter = #ff5c57 chapter = red
scene = #09a1ed scene = blue
note = #cf9c00 note = yellow
[Palette] [Palette]
window = #f3f4f5 window = #f3f4f5
windowtext = #565869 windowtext = default
base = #fafbfc base = #fafbfc
alternatebase = #eaeaeb alternatebase = #eaeaeb
text = #565869 text = default
tooltipbase = #f5e9c2 tooltipbase = #f5e9c2
tooltiptext = #565869 tooltiptext = default
button = #fafbfc button = #fafbfc
buttontext = #565869 buttontext = default
brighttext = #ffffff brighttext = #ffffff
highlight = #09a1ed highlight = blue
highlightedtext = #ffffff highlightedtext = #ffffff
link = #09a1ed link = blue
linkvisited = #09a1ed linkvisited = blue
[GUI] [GUI]
helptext = #09a1ed helptext = blue
fadedtext = #545554 fadedtext = faded
errortext = #ff5c57 errortext = red
[Syntax] [Syntax]
background = #fafbfc background = #fafbfc
text = #565869 text = default
link = #09a1ed link = blue
headertext = #2dae58 headertext = green
headertag = #2dae58a0 headertag = #2dae58a0
emphasis = #f767bb emphasis = purple
dialog = #09a1ed dialog = blue
altdialog = #cf9c00 altdialog = yellow
note = #78bbb9 note = #78bbb9
hidden = #9194a2 hidden = #9194a2
shortcode = #f767bb shortcode = purple
keyword = #09a1ed keyword = blue
tag = #2dae58 tag = green
value = #cf9c00 value = yellow
optional = #cf9c00 optional = yellow
spellcheckline = #ff5c57 spellcheckline = red
errorline = #2dae58 errorline = green
replacetag = #13bbb7 replacetag = cyan
modifier = #f767bb modifier = purple
texthighlight = #cf9c0060 texthighlight = #cf9c0060
+38 -38
View File
@@ -27,8 +27,8 @@ licenseurl = https://github.com/altercation/solarized/blob/master/LICENSE
## ##
[Base] [Base]
default = #e6dfce default = #fdf6e3
faded = #a6a195 faded = #eee8d5
red = #dc322f red = #dc322f
orange = #cb4b16 orange = #cb4b16
yellow = #b58900 yellow = #b58900
@@ -38,53 +38,53 @@ blue = #268bd2
purple = #6c71c4 purple = #6c71c4
[Project] [Project]
root = #2aa198 root = cyan
folder = #2aa198 folder = cyan
file = #e6dfce file = default
title = #859900 title = green
chapter = #dc322f chapter = red
scene = #268bd2 scene = blue
note = #b58900 note = yellow
[Palette] [Palette]
window = #002b36 window = #002b36
windowtext = #fdf6e3 windowtext = default
base = #073642 base = #073642
alternatebase = #586e75 alternatebase = #586e75
text = #fdf6e3 text = default
tooltipbase = #859900 tooltipbase = yellow
tooltiptext = #002b36 tooltiptext = #002b36
button = #073642 button = #073642
buttontext = #fdf6e3 buttontext = default
brighttext = #073642 brighttext = #073642
highlight = #2aa198 highlight = cyan
highlightedtext = #002b36 highlightedtext = #002b36
link = #268bd2 link = blue
linkvisited = #268bd2 linkvisited = blue
[GUI] [GUI]
helptext = #657b83 helptext = purple
fadedtext = #657b83 fadedtext = faded
errortext = #dc322f errortext = red
[Syntax] [Syntax]
background = #073642 background = #073642
text = #fdf6e3 text = default
link = #268bd2 link = blue
headertext = #93a1a1 headertext = default:196
headertag = #2aa198 headertag = cyan
emphasis = #268bd2 emphasis = blue
dialog = #2aa198 dialog = cyan
altdialog = #2aa198 altdialog = cyan
note = #65a19c note = cyan:196
hidden = #93a1a1 hidden = default:196
shortcode = #93a1a1 shortcode = yellow
keyword = #859900 keyword = green
tag = #cb4b16 tag = orange
value = #cb4b16 value = orange
optional = #93a1a1 optional = cyan:196
spellcheckline = #cb4b16 spellcheckline = orange
errorline = #dc322f errorline = red
replacetag = #859900 replacetag = green
modifier = #b58900 modifier = yellow
texthighlight = #b5890060 texthighlight = yellow:128
+43 -42
View File
@@ -27,8 +27,8 @@ licenseurl = https://github.com/altercation/solarized/blob/master/LICENSE
## ##
[Base] [Base]
default = #3b4447 default = #002b36
faded = #4e5b5f faded = #073642
red = #dc322f red = #dc322f
orange = #cb4b16 orange = #cb4b16
yellow = #b58900 yellow = #b58900
@@ -38,53 +38,54 @@ blue = #268bd2
purple = #6c71c4 purple = #6c71c4
[Project] [Project]
root = #2aa198 root = cyan
folder = #2aa198 folder = cyan
file = #3b4447 file = default
title = #859900 title = green
chapter = #dc322f chapter = red
scene = #268bd2 scene = blue
note = #b58900 note = yellow
[Palette] [Palette]
window = #eee8d5 window = #fdf6e3
windowtext = #002b36 windowtext = default
base = #fdf6e3 base = #eee8d5
alternatebase = #93a1a1 alternatebase = #93a1a1
text = #002b36 text = default
tooltipbase = #859900 tooltipbase = yellow
tooltiptext = #002b36 tooltiptext = #002b36
button = #eee8d5 button = #eee8d5
buttontext = #002b36 buttontext = default
brighttext = #fdf6e3 brighttext = #eee8d5
highlight = #2aa198 highlight = cyan
highlightedtext = #fdf6e3 highlightedtext = #fdf6e3
link = #268bd2 link = blue
linkvisited = #268bd2 linkvisited = blue
[GUI] [GUI]
helptext = #4e5b5f helptext = purple
fadedtext = #4e5b5f fadedtext = faded
errortext = #dc322f errortext = red
[Syntax] [Syntax]
background = #fdf6e3 background = #eee8d5
text = #002b36 text = default
link = #268bd2 link = blue
headertext = #586e75 headertext = default:196
headertag = #2aa198 headertag = cyan
emphasis = #268bd2 emphasis = blue
dialog = #2aa198 dialog = cyan
altdialog = #2aa198 altdialog = cyan
note = #1b6660 note = cyan:196
hidden = #586e75 hidden = default:196
shortcode = #586e75 shortcode = yellow
keyword = #859900 keyword = green
tag = #cb4b16 tag = orange
value = #cb4b16 value = orange
optional = #586e75 optional = cyan:196
spellcheckline = #cb4b16 spellcheckline = orange
errorline = #dc322f errorline = red
replacetag = #859900 replacetag = green
modifier = #b58900 modifier = yellow
texthighlight = #b5890060 texthighlight = yellow:128
+10 -10
View File
@@ -5,16 +5,16 @@ author = Veronica Berglyd Olsen (adaptation)
## ##
# Colours: # Colours:
# Background = 30302f : 48, 48, 47 # Background = #30302f
# Foreground = eeeeec : 238, 238, 236 # Foreground = #eeeeec
# Comment = 8f8f8d : 143, 143, 141 # Comment = #8f8f8d
# Red = ef2929 : 239, 41, 41 # Red = #ef2929
# Orange = c4a000 : 196, 160, 0 # Orange = #c4a000
# Yellow = fce94f : 252, 233, 79 # Yellow = #fce94f
# Green = 8ae234 : 138, 226, 52 # Green = #8ae234
# Cyan = 34e2e2 : 52, 226, 226 # Cyan = #34e2e2
# Blue = 3465a4 : 114, 159, 207 # Blue = #3465a4
# Purple = ad7fa8 : 173, 127, 168 # Purple = #ad7fa8
## ##
[Base] [Base]
+7 -7
View File
@@ -7,14 +7,14 @@ author = Veronica Berglyd Olsen (adaptation)
# Colours: # Colours:
# Background = #eeeeec # Background = #eeeeec
# Foreground = #2e3436 # Foreground = #2e3436
# Comment = 8f8f8d : 143, 143, 141 # Comment = #8f8f8d
# Red = #a40000 # Red = #a40000
# Orange = c4a000 : 196, 160, 0 # Orange = #c4a000
# Yellow = fce94f : 252, 233, 79 # Yellow = #fce94f
# Green = 8ae234 : 138, 226, 52 # Green = #8ae234
# Cyan = 34e2e2 : 52, 226, 226 # Cyan = #34e2e2
# Blue = 3465a4 : 114, 159, 207 # Blue = #3465a4
# Purple = ad7fa8 : 173, 127, 168 # Purple = #ad7fa8
## ##
[Base] [Base]
+114
View File
@@ -0,0 +1,114 @@
[
"alert_error",
"alert_info",
"alert_question",
"alert_warn",
"cls_archive",
"cls_character",
"cls_custom",
"cls_entity",
"cls_none",
"cls_novel",
"cls_object",
"cls_plot",
"cls_template",
"cls_timeline",
"cls_trash",
"cls_world",
"prj_folder",
"prj_document",
"prj_title",
"prj_chapter",
"prj_scene",
"prj_note",
"fmt_bold",
"fmt_italic",
"fmt_mark",
"fmt_strike",
"fmt_subscript",
"fmt_superscript",
"fmt_underline",
"fmt_toolbar",
"search",
"search_cancel",
"search_case",
"search_loop",
"search_preserve",
"search_project",
"search_regex",
"search_replace",
"search_word",
"bullet-off",
"bullet-on",
"unfold-hide",
"unfold-show",
"sb_build",
"sb_details",
"sb_novel",
"sb_outline",
"sb_project",
"sb_search",
"sb_stats",
"theme_light",
"theme_dark",
"theme_auto",
"add",
"bookmarks",
"browse",
"build_settings",
"cancel",
"checked",
"chevron_down",
"chevron_left",
"chevron_right",
"chevron_up",
"close",
"copy",
"document_add",
"document",
"edit",
"exclude",
"export",
"filter",
"fit_height",
"fit_width",
"folder",
"font",
"import",
"language",
"lines",
"list",
"margin_bottom",
"margin_left",
"margin_right",
"margin_top",
"maximise",
"minimise",
"more_arrow",
"more_vertical",
"noncheckable",
"open",
"panel",
"pin",
"project_copy",
"quote",
"refresh",
"remove",
"revert",
"settings",
"star",
"stats",
"text",
"timer_off",
"timer",
"unchecked",
"view"
]
+113
View File
@@ -20,6 +20,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
""" """
from __future__ import annotations from __future__ import annotations
import json
from configparser import ConfigParser from configparser import ConfigParser
from pathlib import Path from pathlib import Path
from unittest.mock import MagicMock, Mock from unittest.mock import MagicMock, Mock
@@ -563,3 +565,114 @@ def testGuiTheme_LoadDecorations(monkeypatch):
assert iconCache.getHeaderDecorationNarrow(4) == iconCache._headerDecNarrow[4] assert iconCache.getHeaderDecorationNarrow(4) == iconCache._headerDecNarrow[4]
assert iconCache.getHeaderDecorationNarrow(5) == iconCache._headerDecNarrow[5] assert iconCache.getHeaderDecorationNarrow(5) == iconCache._headerDecNarrow[5]
assert iconCache.getHeaderDecorationNarrow(6) == iconCache._headerDecNarrow[5] assert iconCache.getHeaderDecorationNarrow(6) == iconCache._headerDecNarrow[5]
THEMES = []
_listContent(THEMES, CONFIG.assetPath("themes"), ".conf")
@pytest.mark.gui
@pytest.mark.parametrize("theme", [a.stem for a in THEMES])
def testGuiTheme_CheckTheme(theme):
"""Test loading all themes."""
themes = GuiTheme()
themes.iconCache = MagicMock()
themes._scanThemes(THEMES)
assert theme in themes.colourThemes
current = themes.colourThemes[theme]
if current.dark:
CONFIG.darkTheme = theme
CONFIG.themeMode = nwTheme.DARK
else:
CONFIG.lightTheme = theme
CONFIG.themeMode = nwTheme.LIGHT
# Check loading
themes.loadTheme()
assert themes._meta.name == current.name
assert themes.isDarkTheme == current.dark
# Check completeness
parser = ConfigParser()
parser.read(current.path, encoding="utf-8")
sections = ["Main", "Base", "Project", "Palette", "GUI", "Syntax"]
assert sorted(parser.sections()) == sorted(sections)
structure = {
"Main": [
"name", "mode", # The rest are not required
],
"Base": [
"default", "faded", "red", "orange", "yellow", "green", "cyan",
"blue", "purple",
],
"Project": [
"root", "folder", "file", "title", "chapter", "scene", "note",
],
"Palette": [
"window", "windowtext", "base", "alternatebase", "text",
"tooltipbase", "tooltiptext", "button", "buttontext", "brighttext",
"highlight", "highlightedtext", "link", "linkvisited",
],
"GUI": [
"helptext", "fadedtext", "errortext",
],
"Syntax": [
"background", "text", "link", "headertext", "headertag",
"emphasis", "dialog", "altdialog", "hidden", "note", "shortcode",
"keyword", "tag", "value", "optional", "spellcheckline",
"errorline", "replacetag", "modifier", "texthighlight",
],
}
optional = ["description", "author", "credit", "url", "license", "licenseurl"]
missing = []
for section, options in structure.items():
missing.extend(opt for opt in options if opt not in parser[section])
assert missing == [], "Missing options in theme file"
# Check deprecated
deprecated = []
for section in sections:
deprecated.extend(
opt for opt in parser[section]
if opt not in structure[section] and opt not in optional
)
assert deprecated == [], "Deprecated options in theme file"
ICONS = []
_listContent(ICONS, CONFIG.assetPath("icons"), ".icons")
@pytest.mark.gui
@pytest.mark.parametrize("icons", [a.stem for a in ICONS])
def testGuiTheme_CheckIcons(icons, tstPaths):
"""Test loading all icons."""
keysFile: Path = tstPaths.filesDir / "all_icons.json"
iconKeys = json.loads(keysFile.read_text(encoding="utf-8"))
assert isinstance(iconKeys, list)
CONFIG.lightTheme = DEF_GUI_LIGHT
CONFIG.themeMode = nwTheme.LIGHT
themes = GuiTheme()
themes.initThemes()
iconCache = themes.iconCache
assert icons in iconCache.iconThemes
current = iconCache.iconThemes[icons]
CONFIG.iconTheme = icons
# Check loading
iconCache.loadTheme(icons)
assert iconCache._meta.name == current.name
# Check completeness
missing = [key for key in iconKeys if key not in iconCache._svgData]
assert missing == [], "Missing keys in icons file"
# Check deprecated
deprecated = [key for key in iconCache._svgData if key not in iconKeys]
assert deprecated == [], "Deprecated keys in icons file"
+1
View File
@@ -33,6 +33,7 @@ from utils.common import ROOT_DIR
UTILS = Path(__file__).parent UTILS = Path(__file__).parent
ET.register_namespace("", "http://www.w3.org/2000/svg") ET.register_namespace("", "http://www.w3.org/2000/svg")
ICONS = [ ICONS = [
# Remember to also update tests/files/all_icons.json for test coverage
"alert_error", "alert_error",
"alert_info", "alert_info",
"alert_question", "alert_question",