From e6150e951301d9a1a802b77f95d445251df3927e Mon Sep 17 00:00:00 2001 From: sudacode Date: Fri, 6 Mar 2026 07:51:58 -0800 Subject: [PATCH] fix: update default frequency band colors --- config.example.jsonc | 2 +- scripts/get_frequency.ts | 2 +- src/config/definitions/defaults-subtitle.ts | 2 +- src/config/resolve/subtitle-style.test.ts | 14 ++++++++++++++ src/renderer/state.ts | 2 +- src/renderer/style.css | 8 ++++---- src/renderer/subtitle-render.ts | 2 +- 7 files changed, 23 insertions(+), 9 deletions(-) diff --git a/config.example.jsonc b/config.example.jsonc index d954361..67f18ec 100644 --- a/config.example.jsonc +++ b/config.example.jsonc @@ -139,7 +139,7 @@ "mode": "single", // single: use one color for all matching tokens. banded: use color ramp by frequency band. Values: single | banded "matchMode": "headword", // Frequency lookup text selection mode. Values: headword | surface "singleColor": "#f5a97f", // Color used when frequencyDictionary.mode is `single`. - "bandedColors": ["#ed8796", "#f5a97f", "#f9e2af", "#a6e3a1", "#8aadf4"], // Five colors used for rank bands when mode is `banded` (from most common to least within topX). + "bandedColors": ["#ed8796", "#f5a97f", "#f9e2af", "#8bd5ca", "#8aadf4"], // Five colors used for rank bands when mode is `banded` (from most common to least within topX). }, // Frequency dictionary setting. "secondary": { "fontFamily": "Inter, Noto Sans, Helvetica Neue, sans-serif", // Font family setting. diff --git a/scripts/get_frequency.ts b/scripts/get_frequency.ts index 8b9f3b9..193ae74 100644 --- a/scripts/get_frequency.ts +++ b/scripts/get_frequency.ts @@ -48,7 +48,7 @@ function parseCliArgs(argv: string[]): CliOptions { let colorBand1 = '#ed8796'; let colorBand2 = '#f5a97f'; let colorBand3 = '#f9e2af'; - let colorBand4 = '#a6e3a1'; + let colorBand4 = '#8bd5ca'; let colorBand5 = '#8aadf4'; let colorKnown = '#a6da95'; let colorNPlusOne = '#c6a0f6'; diff --git a/src/config/definitions/defaults-subtitle.ts b/src/config/definitions/defaults-subtitle.ts index 2a6efb5..57446ba 100644 --- a/src/config/definitions/defaults-subtitle.ts +++ b/src/config/definitions/defaults-subtitle.ts @@ -37,7 +37,7 @@ export const SUBTITLE_DEFAULT_CONFIG: Pick = { mode: 'single', matchMode: 'headword', singleColor: '#f5a97f', - bandedColors: ['#ed8796', '#f5a97f', '#f9e2af', '#a6e3a1', '#8aadf4'], + bandedColors: ['#ed8796', '#f5a97f', '#f9e2af', '#8bd5ca', '#8aadf4'], }, secondary: { fontFamily: 'Inter, Noto Sans, Helvetica Neue, sans-serif', diff --git a/src/config/resolve/subtitle-style.test.ts b/src/config/resolve/subtitle-style.test.ts index 9678f79..92575c2 100644 --- a/src/config/resolve/subtitle-style.test.ts +++ b/src/config/resolve/subtitle-style.test.ts @@ -66,6 +66,20 @@ test('subtitleStyle autoPauseVideoOnYomitanPopup falls back on invalid value', ( ); }); +test('subtitleStyle frequencyDictionary defaults to the teal fourth band color', () => { + const { context } = createResolveContext({}); + + applySubtitleDomainConfig(context); + + assert.deepEqual(context.resolved.subtitleStyle.frequencyDictionary.bandedColors, [ + '#ed8796', + '#f5a97f', + '#f9e2af', + '#8bd5ca', + '#8aadf4', + ]); +}); + test('subtitleStyle frequencyDictionary.matchMode accepts valid values and warns on invalid', () => { const valid = createResolveContext({ subtitleStyle: { diff --git a/src/renderer/state.ts b/src/renderer/state.ts index 4572387..6c7d8ff 100644 --- a/src/renderer/state.ts +++ b/src/renderer/state.ts @@ -140,7 +140,7 @@ export function createRendererState(): RendererState { frequencyDictionaryBand1Color: '#ed8796', frequencyDictionaryBand2Color: '#f5a97f', frequencyDictionaryBand3Color: '#f9e2af', - frequencyDictionaryBand4Color: '#a6e3a1', + frequencyDictionaryBand4Color: '#8bd5ca', frequencyDictionaryBand5Color: '#8aadf4', keybindingsMap: new Map(), diff --git a/src/renderer/style.css b/src/renderer/style.css index 5912893..57a8737 100644 --- a/src/renderer/style.css +++ b/src/renderer/style.css @@ -296,7 +296,7 @@ body { --subtitle-frequency-band-1-color: #ed8796; --subtitle-frequency-band-2-color: #f5a97f; --subtitle-frequency-band-3-color: #f9e2af; - --subtitle-frequency-band-4-color: #a6e3a1; + --subtitle-frequency-band-4-color: #8bd5ca; --subtitle-frequency-band-5-color: #8aadf4; text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8), @@ -502,7 +502,7 @@ body.settings-modal-open #subtitleContainer { } #subtitleRoot .word.word-frequency-band-4 { - color: var(--subtitle-frequency-band-4-color, #a6e3a1); + color: var(--subtitle-frequency-band-4-color, #8bd5ca); } #subtitleRoot .word.word-frequency-band-5 { @@ -609,8 +609,8 @@ body.settings-modal-open #subtitleContainer { #subtitleRoot .word.word-frequency-band-4::selection, #subtitleRoot .word.word-frequency-band-4 .c::selection { - color: var(--subtitle-frequency-band-4-color, #a6e3a1) !important; - -webkit-text-fill-color: var(--subtitle-frequency-band-4-color, #a6e3a1) !important; + color: var(--subtitle-frequency-band-4-color, #8bd5ca) !important; + -webkit-text-fill-color: var(--subtitle-frequency-band-4-color, #8bd5ca) !important; } #subtitleRoot .word.word-frequency-band-5::selection, diff --git a/src/renderer/subtitle-render.ts b/src/renderer/subtitle-render.ts index e8eb168..5e0dceb 100644 --- a/src/renderer/subtitle-render.ts +++ b/src/renderer/subtitle-render.ts @@ -75,7 +75,7 @@ const DEFAULT_FREQUENCY_RENDER_SETTINGS: FrequencyRenderSettings = { topX: 1000, mode: 'single', singleColor: '#f5a97f', - bandedColors: ['#ed8796', '#f5a97f', '#f9e2af', '#a6e3a1', '#8aadf4'], + bandedColors: ['#ed8796', '#f5a97f', '#f9e2af', '#8bd5ca', '#8aadf4'], }; function sanitizeFrequencyTopX(value: unknown, fallback: number): number {