Change theme meta settings (#2423)

This commit is contained in:
Veronica Berglyd Olsen
2025-06-20 16:42:55 +02:00
committed by GitHub
26 changed files with 131 additions and 148 deletions
+3 -3
View File
@@ -55,8 +55,6 @@ A colour theme ``.conf`` file consists of the following settings:
author = Veronica Berglyd Olsen
credit = Veronica Berglyd Olsen
url = https://github.com/vkbo/novelWriter
license = CC BY-SA 4.0
licenseurl = https://creativecommons.org/licenses/by-sa/4.0/
[Base]
base = #fcfcfc
@@ -140,7 +138,7 @@ affects.
:header: "Section", "Description"
:class: "tight-table"
"``[Main]``", "Meta data about the theme, You must at least set ``name`` and ``mode``, and ``mode`` must be either ``light`` or ``dark``."
"``[Main]``", "Meta data about the theme, You must at least set ``name``, ``mode`` and ``author``, and ``mode`` must be either ``light`` or ``dark``."
"``[Base]``", "The base colours of the theme. These are also selectable colours in various places inside the app, like for icon colours in **Preferences**."
"``[Project]``", "The colours used for icons and markers for the different project item types."
"``[Palette]``", "The colours used for styling the user interface. The values correspond to the ColorRole_ values in the Qt library."
@@ -177,6 +175,8 @@ There are several ways to enter colour values:
.. versionadded:: 2.8
The ``[Syntax]`` section was moved into the main theme file. Previously, these settings were in
their own file. The ``[Icons]`` section was renamed to ``[Base]``. Added the ``line`` setting.
Dropped the ``license`` and ``licenseurl`` settings. The ``description`` and ``author`` fields
are now required if the theme is included in the app, but not for user themes.
Icon Themes
@@ -1,11 +1,10 @@
[Main]
name = Blue Streak Dark
mode = dark
author = Veronica Berglyd Olsen
credit = Veronica Berglyd Olsen
url = https://github.com/vkbo/novelWriter
license = CC BY-SA 4.0
licenseurl = https://creativecommons.org/licenses/by-sa/4.0/
name = Blue Streak Dark
mode = dark
description = A theme mainly using shades of blue
author = Veronica Berglyd Olsen
credit = Veronica Berglyd Olsen
url = https://github.com/vkbo/novelWriter
[Base]
base = #2d2d2d
@@ -1,11 +1,10 @@
[Main]
name = Blue Streak Light
mode = light
author = Veronica Berglyd Olsen
credit = Veronica Berglyd Olsen
url = https://github.com/vkbo/novelWriter
license = CC BY-SA 4.0
licenseurl = https://creativecommons.org/licenses/by-sa/4.0/
name = Blue Streak Light
mode = light
description = A theme mainly using shades of blue
author = Veronica Berglyd Olsen
credit = Veronica Berglyd Olsen
url = https://github.com/vkbo/novelWriter
[Base]
base = #fcfcfc
@@ -4,8 +4,6 @@ mode = dark
description = A taste of the future 80s
author = Anders Lemvigh
url = https://github.com/alemvigh
license = CC BY-SA 4.0
licenseurl = https://creativecommons.org/licenses/by-sa/4.0/
[Base]
base = #000000
+1 -3
View File
@@ -5,8 +5,6 @@ description = The novelWriter standard dark theme
author = Veronica Berglyd Olsen
credit = Veronica Berglyd Olsen
url = https://github.com/vkbo/novelWriter
license = CC BY-SA 4.0
licenseurl = https://creativecommons.org/licenses/by-sa/4.0/
[Base]
base = #373737
@@ -63,7 +61,7 @@ headertext = green
headertag = green:D150
emphasis = orange
dialog = blue
altdialog = blue
altdialog = red
note = yellow
hidden = faded
shortcode = green
+1 -3
View File
@@ -5,8 +5,6 @@ description = The novelWriter standard light theme
author = Veronica Berglyd Olsen
credit = Veronica Berglyd Olsen
url = https://github.com/vkbo/novelWriter
license = CC BY-SA 4.0
licenseurl = https://creativecommons.org/licenses/by-sa/4.0/
[Base]
base = #fcfcfc
@@ -63,7 +61,7 @@ headertext = green
headertag = green:L135
emphasis = orange
dialog = blue
altdialog = blue
altdialog = red
note = yellow:D125
hidden = faded
shortcode = green
-2
View File
@@ -5,8 +5,6 @@ description = A dark theme with bright colours
author = Veronica Berglyd Olsen (adaptation)
credit = Zeno Rocha
url = https://draculatheme.com
license = MIT
licenseurl = https://github.com/dracula/dracula-theme/blob/main/LICENSE
##
# Colours:
+6 -7
View File
@@ -1,11 +1,10 @@
[Main]
name = Grey Dark
mode = dark
author = Veronica Berglyd Olsen
credit = Veronica Berglyd Olsen
url = https://github.com/vkbo/novelWriter
license = CC BY-SA 4.0
licenseurl = https://creativecommons.org/licenses/by-sa/4.0/
name = Grey Dark
mode = dark
description = A theme with minimal colours
author = Veronica Berglyd Olsen
credit = Veronica Berglyd Olsen
url = https://github.com/vkbo/novelWriter
[Base]
base = #3e3e3e
+6 -7
View File
@@ -1,11 +1,10 @@
[Main]
name = Grey Light
mode = light
author = Veronica Berglyd Olsen
credit = Veronica Berglyd Olsen
url = https://github.com/vkbo/novelWriter
license = CC BY-SA 4.0
licenseurl = https://creativecommons.org/licenses/by-sa/4.0/
name = Grey Light
mode = light
description = A theme with minimal colours
author = Veronica Berglyd Olsen
credit = Veronica Berglyd Olsen
url = https://github.com/vkbo/novelWriter
[Base]
base = #ffffff
+1 -3
View File
@@ -3,10 +3,8 @@ name = LCARS
mode = dark
description = The Next Generation of Star Trek colours
author = Veronica Berglyd Olsen
credit = Veronica Berglyd Olsen
credit = Star Trek TNG
url = https://github.com/vkbo/novelWriter
license = CC BY-SA 4.0
licenseurl = https://creativecommons.org/licenses/by-sa/4.0/
[Base]
base = #101010
+6 -7
View File
@@ -1,11 +1,10 @@
[Main]
name = Light Owl
mode = light
author = Veronica Berglyd Olsen (adaptation)
credit = Sarah Drasner (color theme)
url = https://github.com/sdras/night-owl-vscode-theme
license = MIT License
licenseurl = https://github.com/sdras/night-owl-vscode-theme/blob/master/LICENSE
name = Light Owl
mode = light
description = A theme for the night owls out there, but for daylight
author = Veronica Berglyd Olsen
credit = Sarah Drasner
url = https://github.com/sdras/night-owl-vscode-theme
##
# Theme: Light Owl
+6 -7
View File
@@ -1,11 +1,10 @@
[Main]
name = Night Owl
mode = dark
author = Veronica Berglyd Olsen (adaptation)
credit = Sarah Drasner (color theme)
url = https://github.com/sdras/night-owl-vscode-theme
license = MIT License
licenseurl = https://github.com/sdras/night-owl-vscode-theme/blob/master/LICENSE
name = Night Owl
mode = dark
description = A theme for the night owls out there
author = Veronica Berglyd Olsen
credit = Sarah Drasner
url = https://github.com/sdras/night-owl-vscode-theme
##
# Theme: Night Owl
+6 -7
View File
@@ -1,11 +1,10 @@
[Main]
name = Primer Light
mode = light
author = Myian (adaptation)
credit = GitHub Inc.
url = https://github.com/primer
license = MIT License
licenseurl = https://github.com/primer/brand/blob/main/LICENSE
name = Primer Light
mode = light
description = Primer
author = Myian
credit = GitHub Inc.
url = https://github.com/primer
[Base]
base = #ffffff
+6 -7
View File
@@ -1,11 +1,10 @@
[Main]
name = Primer Night
mode = dark
author = Myian (adaptation)
credit = GitHub Inc.
url = https://github.com/primer
license = MIT License
licenseurl = https://github.com/primer/brand/blob/main/LICENSE
name = Primer Night
mode = dark
description = Primer
author = Myian
credit = GitHub Inc.
url = https://github.com/primer
[Base]
base = #0d1117
+6 -7
View File
@@ -1,11 +1,10 @@
[Main]
name = Snazzy Light
mode = light
author = Veronica Berglyd Olsen (adaptation)
credit = Florian Reuschel (color theme)
url = https://github.com/loilo/vscode-snazzy-light
license = MIT License
licenseurl = https://github.com/loilo/vscode-snazzy-light/blob/master/LICENSE
name = Snazzy Light
mode = light
description = A vivid light color theme
author = Veronica Berglyd Olsen
credit = Florian Reuschel, Sindre Sorhus
url = https://github.com/loilo/vscode-snazzy-light
##
# Colours:
@@ -1,11 +1,10 @@
[Main]
name = Solarized Dark
mode = dark
author = nullbasis
credit = Ethan Schoonover
url = https://ethanschoonover.com/solarized/
license = MIT
licenseurl = https://github.com/altercation/solarized/blob/master/LICENSE
name = Solarized Dark
mode = dark
description = Precision colors for machines and people
author = nullbasis, Veronica Berglyd Olsen
credit = Ethan Schoonover
url = https://ethanschoonover.com/solarized/
##
# base03: #002b36
@@ -1,11 +1,10 @@
[Main]
name = Solarized Light
mode = light
author = nullbasis
credit = Ethan Schoonover
url = https://ethanschoonover.com/solarized/
license = MIT
licenseurl = https://github.com/altercation/solarized/blob/master/LICENSE
name = Solarized Light
mode = light
description = Precision colors for machines and people
author = nullbasis, Veronica Berglyd Olsen
credit = Ethan Schoonover
url = https://ethanschoonover.com/solarized/
##
# base03: #002b36
+6 -3
View File
@@ -1,7 +1,10 @@
[Main]
name = Tango Dark
mode = dark
author = Veronica Berglyd Olsen (adaptation)
name = Tango Dark
mode = dark
description = Colors for everyone
author = Veronica Berglyd Olsen
credit = Tango Desktop Project
url = https://en.wikipedia.org/wiki/Tango_Desktop_Project
##
# Colours:
+6 -3
View File
@@ -1,7 +1,10 @@
[Main]
name = Tango Light
mode = light
author = Veronica Berglyd Olsen (adaptation)
name = Tango Light
mode = light
description = Colors for everyone
author = Veronica Berglyd Olsen
credit = Tango Desktop Project
url = https://en.wikipedia.org/wiki/Tango_Desktop_Project
##
# Colours:
+6 -7
View File
@@ -1,11 +1,10 @@
[Main]
name = Tomorrow
mode = light
author = Veronica Berglyd Olsen (adaptation)
credit = Chris Kempson (color theme)
url = https://github.com/chriskempson/tomorrow-theme
license = MIT License
licenseurl = https://github.com/chriskempson/tomorrow-theme/blob/master/LICENSE.md
name = Tomorrow
mode = light
description = A colourful theme with muted colours and sensible highlighting
author = Veronica Berglyd Olsen
credit = Chris Kempson
url = https://github.com/chriskempson/tomorrow-theme
##
# Theme: Tomorrow
@@ -1,11 +1,10 @@
[Main]
name = Tomorrow Night
mode = dark
author = Veronica Berglyd Olsen (adaptation)
credit = Chris Kempson (color theme)
url = https://github.com/chriskempson/tomorrow-theme
license = MIT License
licenseurl = https://github.com/chriskempson/tomorrow-theme/blob/master/LICENSE.md
name = Tomorrow Night
mode = dark
description = A colourful theme with muted colours and sensible highlighting
author = Veronica Berglyd Olsen
credit = Chris Kempson
url = https://github.com/chriskempson/tomorrow-theme
##
# Theme: Tomorrow Night
@@ -1,11 +1,10 @@
[Main]
name = Tomorrow Night Blue
mode = dark
author = Veronica Berglyd Olsen (adaptation)
credit = Chris Kempson (color theme)
url = https://github.com/chriskempson/tomorrow-theme
license = MIT License
licenseurl = https://github.com/chriskempson/tomorrow-theme/blob/master/LICENSE.md
name = Tomorrow Night Blue
mode = dark
description = A colourful theme with muted colours and sensible highlighting
author = Veronica Berglyd Olsen
credit = Chris Kempson
url = https://github.com/chriskempson/tomorrow-theme
##
# Theme: Tomorrow Night Blue
@@ -1,11 +1,10 @@
[Main]
name = Tomorrow Night Bright
mode = dark
author = Veronica Berglyd Olsen (adaptation)
credit = Chris Kempson (color theme)
url = https://github.com/chriskempson/tomorrow-theme
license = MIT License
licenseurl = https://github.com/chriskempson/tomorrow-theme/blob/master/LICENSE.md
name = Tomorrow Night Bright
mode = dark
description = A colourful theme with muted colours and sensible highlighting
author = Veronica Berglyd Olsen
credit = Chris Kempson
url = https://github.com/chriskempson/tomorrow-theme
##
# Theme: Tomorrow Night Bright
@@ -1,11 +1,10 @@
[Main]
name = Tomorrow Night Eighties
mode = dark
author = Veronica Berglyd Olsen (adaptation)
credit = Chris Kempson (color theme)
url = https://github.com/chriskempson/tomorrow-theme
license = MIT License
licenseurl = https://github.com/chriskempson/tomorrow-theme/blob/master/LICENSE.md
name = Tomorrow Night Eighties
mode = dark
description = A colourful theme with muted colours and sensible highlighting
author = Veronica Berglyd Olsen
credit = Chris Kempson
url = https://github.com/chriskempson/tomorrow-theme
##
# Theme: Tomorrow Night Eighties
+15 -12
View File
@@ -72,8 +72,13 @@ class ThemeMeta:
author: str = ""
credit: str = ""
url: str = ""
license: str = ""
licenseUrl: str = ""
class IconsMeta:
name: str = ""
author: str = ""
license: str = ""
class SyntaxColors:
@@ -296,12 +301,10 @@ class GuiTheme:
if parser.has_section(sec):
meta.name = parser.get(sec, "name", fallback="")
meta.mode = parser.get(sec, "mode", fallback="light")
meta.description = parser.get(sec, "description", fallback="N/A")
meta.author = parser.get(sec, "author", fallback="N/A")
meta.credit = parser.get(sec, "credit", fallback="N/A")
meta.description = parser.get(sec, "description", fallback="")
meta.author = parser.get(sec, "author", fallback="")
meta.credit = parser.get(sec, "credit", fallback="")
meta.url = parser.get(sec, "url", fallback="")
meta.license = parser.get(sec, "license", fallback="N/A")
meta.licenseUrl = parser.get(sec, "licenseurl", fallback="")
self._meta = meta
@@ -613,13 +616,13 @@ class GuiTheme:
parser.clear()
parser.read(file, encoding="utf-8")
name = parser.get("Main", "name", fallback="")
dark = parser.get("Main", "mode", fallback="light").lower() == "dark"
if name:
mode = parser.get("Main", "mode", fallback="").lower()
if name and mode in ("light", "dark"):
key = file.stem
prefix = "*" if key.startswith("default") else ""
lookup = f"{prefix}{name} {key}"
keys.append(lookup)
data[lookup] = (file.stem, name, dark, file)
data[lookup] = (file.stem, name, mode == "dark", file)
except Exception: # noqa: PERF203
logger.error("Could not read file: %s", file)
logException()
@@ -659,7 +662,7 @@ class GuiIcons:
def __init__(self, mainTheme: GuiTheme) -> None:
self._theme = mainTheme
self._meta = ThemeMeta()
self._meta = IconsMeta()
# Storage
self._allThemes: dict[str, ThemeEntry] = {}
@@ -722,7 +725,7 @@ class GuiIcons:
CONFIG.splashMessage(f"Loading icon theme: {entry.name}")
logger.info("Loading icon theme '%s'", theme)
try:
meta = ThemeMeta()
meta = IconsMeta()
with open(entry.path, mode="r", encoding="utf-8") as icons:
for icon in icons:
bits = icon.partition("=")
+2 -2
View File
@@ -613,7 +613,7 @@ def testGuiTheme_CheckTheme(theme):
structure = {
"Main": [
"name", "mode", # The rest are not required
"name", "mode", "description", "author", # The rest are not required
],
"Base": [
"base", "default", "faded", "red", "orange", "yellow", "green",
@@ -638,7 +638,7 @@ def testGuiTheme_CheckTheme(theme):
"errorline", "replacetag", "modifier", "texthighlight",
],
}
optional = ["description", "author", "credit", "url", "license", "licenseurl"]
optional = ["credit", "url"]
missing = []
for section, options in structure.items():
missing.extend(opt for opt in options if opt not in parser[section])