mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-15 19:19:58 -04:00
Give the launcher's colour schemes plain names.
The six schemes were named after places in the game. They are now Forest, Volcano, Lake, Desert, Temple and Shadow, in the same order and colours, and their ids in launcher.json follow (forest is the default). A launcher.json that names one of the old ids gets the default scheme, as with any name it does not know. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -35,10 +35,10 @@ drawn in code (`launcher/ui/art.py`); no texture, font or sound of the game is i
|
||||
|
||||
Customize Launcher (on the home screen) makes the look the player's own:
|
||||
|
||||
- Color Scheme: Kokiri Forest (the colours above), Death Mountain, Zora's Domain, Gerudo Valley, Temple of Time and
|
||||
Shadow Temple. A scheme is the first one with its woods, accents, backdrop and glow turned to other hues
|
||||
(`art.THEMES`, `art.recolor`), so each keeps the same light and dark steps and the same readable text. The window is
|
||||
drawn again in the new colours at once.
|
||||
- Color Scheme: Forest (the colours above), Volcano, Lake, Desert, Temple and Shadow. A scheme is the first one with
|
||||
its woods, accents, backdrop and glow turned to other hues (`art.THEMES`, `art.recolor`), so each keeps the same
|
||||
light and dark steps and the same readable text. The window is drawn again in the new colours at once. The names
|
||||
are plain words, not the game's.
|
||||
- Background: a picture of the player's own behind the panels instead of the scheme's backdrop (`launcher/ui/picture.py`:
|
||||
PNG, JPEG, WebP, BMP, GIF or TIFF, read with Pillow). It is cut to the window's shape around its middle and kept as
|
||||
`data/background.npy`, so the launcher needs the file no more; Background Dimming darkens it (0 to 80 %) for the
|
||||
|
||||
@@ -15,7 +15,7 @@ DEFAULTS = {
|
||||
'desktop_shortcut': True,
|
||||
'save_export_dir': '', # where Saves > Export Save writes its zip; empty: the Downloads folder
|
||||
'export_with_log': True, # Export Save adds the game's latest log and nx2navi.ini (for a bug report)
|
||||
'theme': 'kokiri', # the colour scheme (launcher/ui/art.py THEMES)
|
||||
'theme': 'forest', # the colour scheme (launcher/ui/art.py THEMES)
|
||||
'background': '', # the picture the player chose as the background; its fitted copy is data/background.npy
|
||||
'background_dim': 40, # how much that picture is darkened, in percent
|
||||
'animations': True, # the cursor glides, screens slide in, sparks drift, Navi bobs
|
||||
|
||||
@@ -19,7 +19,7 @@ import numpy as np
|
||||
|
||||
# ---------------------------------------------------------------- colours
|
||||
|
||||
# The first colour scheme, Kokiri Forest: bronze wood on a misty dark green.
|
||||
# The first colour scheme, Forest: bronze wood on a misty dark green.
|
||||
BASE = {
|
||||
'window': '#06180d',
|
||||
'panel': '#3a2b22',
|
||||
@@ -64,19 +64,19 @@ GROUPS = {
|
||||
# None to keep each colour's own, saturation factor, lightness factor, saturation added), applied to the first
|
||||
# scheme's colours (recolor), so a scheme keeps the first one's light and dark steps. 'set': colours given as they are.
|
||||
THEMES = {
|
||||
'kokiri': {'label': 'Kokiri Forest'},
|
||||
'death_mountain': {'label': 'Death Mountain', 'wood': (14, 0.95, 0.80, 0), 'accent': (16, 1.05, 1.0, 0),
|
||||
'forest': {'label': 'Forest'},
|
||||
'volcano': {'label': 'Volcano', 'wood': (14, 0.95, 0.80, 0), 'accent': (16, 1.05, 1.0, 0),
|
||||
'scene': (6, 1.0, 1.0, 0.25), 'glow': (30, 1.0, 1.0, 0), 'text': (30, 1.0, 1.0, 0)},
|
||||
'zora': {'label': "Zora's Domain", 'wood': (207, 0.75, 0.92, 0), 'accent': (188, 0.95, 1.0, 0),
|
||||
'lake': {'label': 'Lake', 'wood': (207, 0.75, 0.92, 0), 'accent': (188, 0.95, 1.0, 0),
|
||||
'scene': (200, 1.0, 1.05, 0.2), 'glow': (185, 1.0, 1.0, 0), 'text': (200, 0.55, 1.02, 0)},
|
||||
'gerudo': {'label': 'Gerudo Valley', 'wood': (26, 1.15, 1.0, 0), 'accent': (352, 0.9, 1.0, 0),
|
||||
'desert': {'label': 'Desert', 'wood': (26, 1.15, 1.0, 0), 'accent': (352, 0.9, 1.0, 0),
|
||||
'scene': (318, 0.8, 0.95, 0.15), 'glow': (45, 1.0, 1.0, 0), 'text': (36, 1.0, 1.0, 0)},
|
||||
'temple': {'label': 'Temple of Time', 'wood': (220, 0.22, 0.95, 0), 'accent': (46, 0.95, 1.02, 0),
|
||||
'temple': {'label': 'Temple', 'wood': (220, 0.22, 0.95, 0), 'accent': (46, 0.95, 1.02, 0),
|
||||
'scene': (222, 0.55, 1.0, 0.05), 'glow': (48, 1.0, 1.0, 0.5), 'text': (48, 0.45, 1.02, 0)},
|
||||
'shadow': {'label': 'Shadow Temple', 'wood': (268, 0.55, 0.78, 0), 'accent': (286, 0.75, 1.0, 0),
|
||||
'shadow': {'label': 'Shadow', 'wood': (268, 0.55, 0.78, 0), 'accent': (286, 0.75, 1.0, 0),
|
||||
'scene': (272, 0.9, 0.8, 0.2), 'glow': (280, 1.0, 1.0, 0.2), 'text': (270, 0.5, 1.0, 0)},
|
||||
}
|
||||
DEFAULT_THEME = 'kokiri'
|
||||
DEFAULT_THEME = 'forest'
|
||||
|
||||
|
||||
def recolor(hexcolor, hue, sat=1.0, light=1.0, add=0.0):
|
||||
|
||||
@@ -2447,7 +2447,7 @@ class LookTest(Tmp):
|
||||
|
||||
def test_every_colour_scheme_has_every_colour(self):
|
||||
art = self.art
|
||||
self.assertEqual(art.theme_palette('kokiri'), art.BASE) # the first scheme is the colours as written
|
||||
self.assertEqual(art.theme_palette('forest'), art.BASE) # the first scheme is the colours as written
|
||||
for name, t in art.THEMES.items():
|
||||
pal = art.theme_palette(name)
|
||||
self.assertEqual(set(pal), set(art.BASE), name)
|
||||
@@ -2462,15 +2462,15 @@ class LookTest(Tmp):
|
||||
art = self.art
|
||||
held = art.PALETTE
|
||||
try:
|
||||
self.assertEqual(art.set_theme('zora'), 'zora')
|
||||
self.assertEqual(art.set_theme('lake'), 'lake')
|
||||
self.assertIs(art.PALETTE, held)
|
||||
self.assertNotEqual(held['panel'], art.BASE['panel'])
|
||||
self.assertEqual(held['salmon'], art.BASE['salmon']) # a warning stays a warning in every scheme
|
||||
self.assertEqual(art.set_theme('no such scheme'), 'kokiri')
|
||||
self.assertEqual(art.set_theme('no such scheme'), 'forest')
|
||||
self.assertEqual(dict(held), art.BASE)
|
||||
self.assertEqual(art.set_theme(None), 'kokiri') # launcher.json without the key
|
||||
self.assertEqual(art.set_theme(None), 'forest') # launcher.json without the key
|
||||
finally:
|
||||
art.set_theme('kokiri')
|
||||
art.set_theme('forest')
|
||||
|
||||
def test_recolor_keeps_light_and_dark(self):
|
||||
import colorsys
|
||||
@@ -2639,14 +2639,14 @@ class LookTest(Tmp):
|
||||
path = self.tmp / 'launcher.json'
|
||||
s = settings.Settings(path)
|
||||
self.assertEqual((s['theme'], s['background'], s['background_dim'], s['animations'], s['sounds']),
|
||||
('kokiri', '', 40, True, 'low'))
|
||||
('forest', '', 40, True, 'low'))
|
||||
s['theme'], s['sounds'], s['background_dim'] = 'shadow', 'high', 60
|
||||
s.save()
|
||||
t = settings.Settings(path)
|
||||
self.assertEqual((t['theme'], t['sounds'], t['background_dim']), ('shadow', 'high', 60))
|
||||
path.write_text(json.dumps({'theme': 5, 'animations': 'yes', 'background_dim': '40'}))
|
||||
u = settings.Settings(path) # values of the wrong kind: the defaults
|
||||
self.assertEqual((u['theme'], u['animations'], u['background_dim']), ('kokiri', True, 40))
|
||||
self.assertEqual((u['theme'], u['animations'], u['background_dim']), ('forest', True, 40))
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- the window
|
||||
|
||||
Reference in New Issue
Block a user