Anki maturity-based known-word highlighting (#172)

This commit is contained in:
2026-07-27 23:58:02 -07:00
committed by GitHub
parent 08c6807cb1
commit 987b325edb
54 changed files with 3046 additions and 381 deletions
@@ -60,6 +60,8 @@ export const INTEGRATIONS_DEFAULT_CONFIG: Pick<
},
knownWords: {
highlightEnabled: false,
maturityEnabled: false,
matureThresholdDays: 21,
refreshMinutes: 1440,
addMinedWordsImmediately: true,
matchMode: 'headword',
@@ -32,6 +32,12 @@ export const SUBTITLE_DEFAULT_CONFIG: Pick<ResolvedConfig, 'subtitleStyle' | 'su
backdropFilter: 'blur(6px)',
nPlusOneColor: '#c6a0f6',
knownWordColor: '#a6da95',
knownWordMaturityColors: {
new: '#ee99a0',
learning: '#b7bdf8',
young: '#91d7e3',
mature: '#a6da95',
},
jlptColors: {
N1: '#ed8796',
N2: '#f5a97f',
@@ -295,6 +295,20 @@ export function buildIntegrationConfigOptionRegistry(
defaultValue: defaultConfig.ankiConnect.knownWords.highlightEnabled,
description: 'Enable fast local highlighting for words already known in Anki.',
},
{
path: 'ankiConnect.knownWords.maturityEnabled',
kind: 'boolean',
defaultValue: defaultConfig.ankiConnect.knownWords.maturityEnabled,
description:
'Color known-word highlights by Anki card maturity (new, learning, young, mature) instead of a single color. Requires known-word highlighting.',
},
{
path: 'ankiConnect.knownWords.matureThresholdDays',
kind: 'number',
defaultValue: defaultConfig.ankiConnect.knownWords.matureThresholdDays,
description:
'Card interval in days at which a known word counts as mature (Anki convention: 21).',
},
{
path: 'ankiConnect.knownWords.refreshMinutes',
kind: 'number',
@@ -109,6 +109,34 @@ export function buildSubtitleConfigOptionRegistry(
defaultValue: defaultConfig.subtitleStyle.nPlusOneColor,
description: 'Color used for the single N+1 target token subtitle highlight.',
},
{
path: 'subtitleStyle.knownWordMaturityColors.new',
kind: 'string',
defaultValue: defaultConfig.subtitleStyle.knownWordMaturityColors.new,
description:
'Color for known words whose Anki cards are new (never reviewed), when maturity highlighting is enabled.',
},
{
path: 'subtitleStyle.knownWordMaturityColors.learning',
kind: 'string',
defaultValue: defaultConfig.subtitleStyle.knownWordMaturityColors.learning,
description:
'Color for known words whose Anki cards are in (re)learning, when maturity highlighting is enabled.',
},
{
path: 'subtitleStyle.knownWordMaturityColors.young',
kind: 'string',
defaultValue: defaultConfig.subtitleStyle.knownWordMaturityColors.young,
description:
'Color for known words whose Anki cards are in review below the mature threshold, when maturity highlighting is enabled.',
},
{
path: 'subtitleStyle.knownWordMaturityColors.mature',
kind: 'string',
defaultValue: defaultConfig.subtitleStyle.knownWordMaturityColors.mature,
description:
'Color for known words whose Anki cards are at or above the mature interval threshold, when maturity highlighting is enabled.',
},
{
path: 'subtitleStyle.frequencyDictionary.enabled',
kind: 'boolean',
+16
View File
@@ -35,6 +35,22 @@ export function buildRuntimeOptionRegistry(
},
}),
},
{
id: 'subtitle.annotation.knownWords.maturityEnabled',
path: 'ankiConnect.knownWords.maturityEnabled',
label: 'Known Word Maturity Colors',
scope: 'subtitle',
valueType: 'boolean',
allowedValues: [true, false],
defaultValue: defaultConfig.ankiConnect.knownWords.maturityEnabled,
requiresRestart: false,
formatValueForOsd: (value) => (value === true ? 'On' : 'Off'),
toAnkiPatch: (value) => ({
knownWords: {
maturityEnabled: value === true,
},
}),
},
{
id: 'subtitle.annotation.nPlusOne',
path: 'ankiConnect.nPlusOne.enabled',