fix: update default frequency band colors

This commit is contained in:
2026-03-06 07:51:58 -08:00
parent 40521e769d
commit e6150e9513
7 changed files with 23 additions and 9 deletions

View File

@@ -139,7 +139,7 @@
"mode": "single", // single: use one color for all matching tokens. banded: use color ramp by frequency band. Values: single | banded "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 "matchMode": "headword", // Frequency lookup text selection mode. Values: headword | surface
"singleColor": "#f5a97f", // Color used when frequencyDictionary.mode is `single`. "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. }, // Frequency dictionary setting.
"secondary": { "secondary": {
"fontFamily": "Inter, Noto Sans, Helvetica Neue, sans-serif", // Font family setting. "fontFamily": "Inter, Noto Sans, Helvetica Neue, sans-serif", // Font family setting.

View File

@@ -48,7 +48,7 @@ function parseCliArgs(argv: string[]): CliOptions {
let colorBand1 = '#ed8796'; let colorBand1 = '#ed8796';
let colorBand2 = '#f5a97f'; let colorBand2 = '#f5a97f';
let colorBand3 = '#f9e2af'; let colorBand3 = '#f9e2af';
let colorBand4 = '#a6e3a1'; let colorBand4 = '#8bd5ca';
let colorBand5 = '#8aadf4'; let colorBand5 = '#8aadf4';
let colorKnown = '#a6da95'; let colorKnown = '#a6da95';
let colorNPlusOne = '#c6a0f6'; let colorNPlusOne = '#c6a0f6';

View File

@@ -37,7 +37,7 @@ export const SUBTITLE_DEFAULT_CONFIG: Pick<ResolvedConfig, 'subtitleStyle'> = {
mode: 'single', mode: 'single',
matchMode: 'headword', matchMode: 'headword',
singleColor: '#f5a97f', singleColor: '#f5a97f',
bandedColors: ['#ed8796', '#f5a97f', '#f9e2af', '#a6e3a1', '#8aadf4'], bandedColors: ['#ed8796', '#f5a97f', '#f9e2af', '#8bd5ca', '#8aadf4'],
}, },
secondary: { secondary: {
fontFamily: 'Inter, Noto Sans, Helvetica Neue, sans-serif', fontFamily: 'Inter, Noto Sans, Helvetica Neue, sans-serif',

View File

@@ -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', () => { test('subtitleStyle frequencyDictionary.matchMode accepts valid values and warns on invalid', () => {
const valid = createResolveContext({ const valid = createResolveContext({
subtitleStyle: { subtitleStyle: {

View File

@@ -140,7 +140,7 @@ export function createRendererState(): RendererState {
frequencyDictionaryBand1Color: '#ed8796', frequencyDictionaryBand1Color: '#ed8796',
frequencyDictionaryBand2Color: '#f5a97f', frequencyDictionaryBand2Color: '#f5a97f',
frequencyDictionaryBand3Color: '#f9e2af', frequencyDictionaryBand3Color: '#f9e2af',
frequencyDictionaryBand4Color: '#a6e3a1', frequencyDictionaryBand4Color: '#8bd5ca',
frequencyDictionaryBand5Color: '#8aadf4', frequencyDictionaryBand5Color: '#8aadf4',
keybindingsMap: new Map(), keybindingsMap: new Map(),

View File

@@ -296,7 +296,7 @@ body {
--subtitle-frequency-band-1-color: #ed8796; --subtitle-frequency-band-1-color: #ed8796;
--subtitle-frequency-band-2-color: #f5a97f; --subtitle-frequency-band-2-color: #f5a97f;
--subtitle-frequency-band-3-color: #f9e2af; --subtitle-frequency-band-3-color: #f9e2af;
--subtitle-frequency-band-4-color: #a6e3a1; --subtitle-frequency-band-4-color: #8bd5ca;
--subtitle-frequency-band-5-color: #8aadf4; --subtitle-frequency-band-5-color: #8aadf4;
text-shadow: text-shadow:
2px 2px 4px rgba(0, 0, 0, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.8),
@@ -502,7 +502,7 @@ body.settings-modal-open #subtitleContainer {
} }
#subtitleRoot .word.word-frequency-band-4 { #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 { #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::selection,
#subtitleRoot .word.word-frequency-band-4 .c::selection { #subtitleRoot .word.word-frequency-band-4 .c::selection {
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, #a6e3a1) !important; -webkit-text-fill-color: var(--subtitle-frequency-band-4-color, #8bd5ca) !important;
} }
#subtitleRoot .word.word-frequency-band-5::selection, #subtitleRoot .word.word-frequency-band-5::selection,

View File

@@ -75,7 +75,7 @@ const DEFAULT_FREQUENCY_RENDER_SETTINGS: FrequencyRenderSettings = {
topX: 1000, topX: 1000,
mode: 'single', mode: 'single',
singleColor: '#f5a97f', singleColor: '#f5a97f',
bandedColors: ['#ed8796', '#f5a97f', '#f9e2af', '#a6e3a1', '#8aadf4'], bandedColors: ['#ed8796', '#f5a97f', '#f9e2af', '#8bd5ca', '#8aadf4'],
}; };
function sanitizeFrequencyTopX(value: unknown, fallback: number): number { function sanitizeFrequencyTopX(value: unknown, fallback: number): number {