feat(config): refresh subtitle style defaults and drop plugin legacy startup alias

This commit is contained in:
2026-02-27 00:03:07 -08:00
parent 771ea5777f
commit c7c91077fd
9 changed files with 114 additions and 49 deletions

View File

@@ -28,7 +28,21 @@ test('loads defaults when config is missing', () => {
assert.equal(config.subtitleStyle.backgroundColor, 'rgb(30, 32, 48, 0.88)');
assert.equal(config.subtitleStyle.preserveLineBreaks, false);
assert.equal(config.subtitleStyle.hoverTokenColor, '#f4dbd6');
assert.equal(config.subtitleStyle.hoverTokenBackgroundColor, '#363a4fd6');
assert.equal(config.subtitleStyle.hoverTokenBackgroundColor, 'rgba(54, 58, 79, 0.84)');
assert.equal(
config.subtitleStyle.fontFamily,
'M PLUS 1 Medium, Source Han Sans JP, Noto Sans CJK JP',
);
assert.equal(config.subtitleStyle.fontWeight, '600');
assert.equal(config.subtitleStyle.lineHeight, 1.35);
assert.equal(config.subtitleStyle.letterSpacing, '-0.01em');
assert.equal(config.subtitleStyle.wordSpacing, 0);
assert.equal(config.subtitleStyle.fontKerning, 'normal');
assert.equal(config.subtitleStyle.textRendering, 'geometricPrecision');
assert.equal(config.subtitleStyle.textShadow, '0 3px 10px rgba(0,0,0,0.69)');
assert.equal(config.subtitleStyle.backdropFilter, 'blur(6px)');
assert.equal(config.subtitleStyle.secondary.fontFamily, 'Manrope, Inter');
assert.equal(config.subtitleStyle.secondary.fontColor, '#cad3f5');
assert.equal(config.immersionTracking.enabled, true);
assert.equal(config.immersionTracking.dbPath, '');
assert.equal(config.immersionTracking.batchSize, 25);

View File

@@ -5,14 +5,20 @@ export const SUBTITLE_DEFAULT_CONFIG: Pick<ResolvedConfig, 'subtitleStyle'> = {
enableJlpt: false,
preserveLineBreaks: false,
hoverTokenColor: '#f4dbd6',
hoverTokenBackgroundColor: '#363a4fd6',
fontFamily:
'M PLUS 1, Noto Sans CJK JP Regular, Noto Sans CJK JP, Hiragino Sans, Hiragino Kaku Gothic ProN, Yu Gothic, Arial Unicode MS, Arial, sans-serif',
hoverTokenBackgroundColor: 'rgba(54, 58, 79, 0.84)',
fontFamily: 'M PLUS 1 Medium, Source Han Sans JP, Noto Sans CJK JP',
fontSize: 35,
fontColor: '#cad3f5',
fontWeight: 'normal',
fontWeight: '600',
lineHeight: 1.35,
letterSpacing: '-0.01em',
wordSpacing: 0,
fontKerning: 'normal',
textRendering: 'geometricPrecision',
textShadow: '0 3px 10px rgba(0,0,0,0.69)',
fontStyle: 'normal',
backgroundColor: 'rgb(30, 32, 48, 0.88)',
backdropFilter: 'blur(6px)',
nPlusOneColor: '#c6a0f6',
knownWordColor: '#a6da95',
jlptColors: {
@@ -31,13 +37,19 @@ export const SUBTITLE_DEFAULT_CONFIG: Pick<ResolvedConfig, 'subtitleStyle'> = {
bandedColors: ['#ed8796', '#f5a97f', '#f9e2af', '#a6e3a1', '#8aadf4'],
},
secondary: {
fontFamily: 'Manrope, Inter',
fontSize: 24,
fontColor: '#ffffff',
fontColor: '#cad3f5',
lineHeight: 1.35,
letterSpacing: '-0.01em',
wordSpacing: 0,
fontKerning: 'normal',
textRendering: 'geometricPrecision',
textShadow: '0 3px 10px rgba(0,0,0,0.69)',
backgroundColor: 'transparent',
backdropFilter: 'blur(6px)',
fontWeight: 'normal',
fontStyle: 'normal',
fontFamily:
'M PLUS 1, Noto Sans CJK JP Regular, Noto Sans CJK JP, Hiragino Sans, Hiragino Kaku Gothic ProN, Yu Gothic, Arial Unicode MS, Arial, sans-serif',
},
},
};

View File

@@ -509,7 +509,7 @@ function renderSubtitle(data: SubtitleData | string): void {
if (style.fontColor) {
ctx.dom.subtitleRoot.style.color = style.fontColor;
}
if (style.fontWeight) ctx.dom.subtitleRoot.style.fontWeight = style.fontWeight;
if (style.fontWeight) ctx.dom.subtitleRoot.style.fontWeight = String(style.fontWeight);
if (style.fontStyle) ctx.dom.subtitleRoot.style.fontStyle = style.fontStyle;
const knownWordColor = style.knownWordColor ?? ctx.state.knownWordColor ?? '#a6da95';
const nPlusOneColor = style.nPlusOneColor ?? ctx.state.nPlusOneColor ?? '#c6a0f6';
@@ -639,7 +639,7 @@ function renderSubtitle(data: SubtitleData | string): void {
ctx.dom.secondarySubRoot.style.color = secondaryStyle.fontColor;
}
if (secondaryStyle.fontWeight) {
ctx.dom.secondarySubRoot.style.fontWeight = secondaryStyle.fontWeight;
ctx.dom.secondarySubRoot.style.fontWeight = String(secondaryStyle.fontWeight);
}
if (secondaryStyle.fontStyle) {
ctx.dom.secondarySubRoot.style.fontStyle = secondaryStyle.fontStyle;

View File

@@ -274,8 +274,15 @@ export interface SubtitleStyleConfig {
fontFamily?: string;
fontSize?: number;
fontColor?: string;
fontWeight?: string;
fontWeight?: string | number;
fontStyle?: string;
lineHeight?: string | number;
letterSpacing?: string;
wordSpacing?: string | number;
fontKerning?: string;
textRendering?: string;
textShadow?: string;
backdropFilter?: string;
backgroundColor?: string;
nPlusOneColor?: string;
knownWordColor?: string;
@@ -298,8 +305,15 @@ export interface SubtitleStyleConfig {
fontFamily?: string;
fontSize?: number;
fontColor?: string;
fontWeight?: string;
fontWeight?: string | number;
fontStyle?: string;
lineHeight?: string | number;
letterSpacing?: string;
wordSpacing?: string | number;
fontKerning?: string;
textRendering?: string;
textShadow?: string;
backdropFilter?: string;
backgroundColor?: string;
};
}