Add vendor dict fallback logic

This commit is contained in:
2026-02-15 22:45:03 -08:00
parent dae1f817e0
commit 01a48f4714
21 changed files with 1194 additions and 19 deletions

View File

@@ -195,6 +195,20 @@ export const DEFAULT_CONFIG: ResolvedConfig = {
N4: "#a6e3a1",
N5: "#8aadf4",
},
frequencyDictionary: {
enabled: false,
sourcePath: "",
topX: 1000,
mode: "single",
singleColor: "#f5a97f",
bandedColors: [
"#ed8796",
"#f5a97f",
"#f9e2af",
"#a6e3a1",
"#8aadf4",
],
},
secondary: {
fontSize: 24,
fontColor: "#ffffff",
@@ -306,6 +320,48 @@ export const CONFIG_OPTION_REGISTRY: ConfigOptionRegistryEntry[] = [
description: "Enable JLPT vocabulary level underlines. "
+ "When disabled, JLPT tagging lookup and underlines are skipped.",
},
{
path: "subtitleStyle.frequencyDictionary.enabled",
kind: "boolean",
defaultValue: DEFAULT_CONFIG.subtitleStyle.frequencyDictionary.enabled,
description:
"Enable frequency-dictionary-based highlighting based on token rank.",
},
{
path: "subtitleStyle.frequencyDictionary.sourcePath",
kind: "string",
defaultValue: DEFAULT_CONFIG.subtitleStyle.frequencyDictionary.sourcePath,
description:
"Optional absolute path to a frequency dictionary directory."
+ " If empty, built-in discovery search paths are used.",
},
{
path: "subtitleStyle.frequencyDictionary.topX",
kind: "number",
defaultValue: DEFAULT_CONFIG.subtitleStyle.frequencyDictionary.topX,
description: "Only color tokens with frequency rank <= topX (default: 1000).",
},
{
path: "subtitleStyle.frequencyDictionary.mode",
kind: "enum",
enumValues: ["single", "banded"],
defaultValue: DEFAULT_CONFIG.subtitleStyle.frequencyDictionary.mode,
description:
"single: use one color for all matching tokens. banded: use color ramp by frequency band.",
},
{
path: "subtitleStyle.frequencyDictionary.singleColor",
kind: "string",
defaultValue: DEFAULT_CONFIG.subtitleStyle.frequencyDictionary.singleColor,
description: "Color used when frequencyDictionary.mode is `single`.",
},
{
path: "subtitleStyle.frequencyDictionary.bandedColors",
kind: "array",
defaultValue: DEFAULT_CONFIG.subtitleStyle.frequencyDictionary.bandedColors,
description:
"Five colors used for rank bands when mode is `banded` (from most common to least within topX).",
},
{
path: "ankiConnect.enabled",
kind: "boolean",