From 5da16c0f067af141401bf1e3e8a667553501d60c Mon Sep 17 00:00:00 2001 From: GithubAnon0000 <160563432+GithubAnon0000@users.noreply.github.com> Date: Mon, 29 Sep 2025 22:28:48 +0200 Subject: [PATCH] FEAT/ADD: Option for colored answer buttons --- ftl/core/preferences.ftl | 1 + proto/anki/config.proto | 1 + qt/aqt/forms/preferences.ui | 13 +++++++++++++ qt/aqt/preferences.py | 2 ++ qt/aqt/reviewer.py | 15 ++++++++++++++- rslib/src/config/bool.rs | 3 +++ rslib/src/preferences.rs | 6 ++++++ 7 files changed, 40 insertions(+), 1 deletion(-) diff --git a/ftl/core/preferences.ftl b/ftl/core/preferences.ftl index 23b72f267..aa09cb2ce 100644 --- a/ftl/core/preferences.ftl +++ b/ftl/core/preferences.ftl @@ -22,6 +22,7 @@ preferences-scheduling = Scheduling preferences-show-learning-cards-with-larger-steps = Show learning cards with larger steps before reviews preferences-show-next-review-time-above-answer = Show next review time above answer buttons preferences-spacebar-rates-card = Spacebar (or enter) also answers card +preferences-show-colored-buttons = Show colored border on answer buttons preferences-show-play-buttons-on-cards-with = Show play buttons on cards with audio preferences-show-remaining-card-count = Show remaining card count preferences-some-settings-will-take-effect-after = Some settings will take effect after you restart Anki. diff --git a/proto/anki/config.proto b/proto/anki/config.proto index ea115f0fc..f3619f237 100644 --- a/proto/anki/config.proto +++ b/proto/anki/config.proto @@ -120,6 +120,7 @@ message Preferences { uint32 time_limit_secs = 5; bool load_balancer_enabled = 6; bool fsrs_short_term_with_steps_enabled = 7; + bool hide_colored_buttons = 8; } message Editing { bool adding_defaults_to_current_deck = 1; diff --git a/qt/aqt/forms/preferences.ui b/qt/aqt/forms/preferences.ui index 0035e1f42..2c285569a 100644 --- a/qt/aqt/forms/preferences.ui +++ b/qt/aqt/forms/preferences.ui @@ -373,6 +373,19 @@ preferences_review + + + + + 0 + 0 + + + + preferences_show_colored_buttons + + + diff --git a/qt/aqt/preferences.py b/qt/aqt/preferences.py index afce6d489..e6d5a487a 100644 --- a/qt/aqt/preferences.py +++ b/qt/aqt/preferences.py @@ -137,6 +137,7 @@ class Preferences(QDialog): form.showEstimates.setChecked(reviewing.show_intervals_on_buttons) form.showProgress.setChecked(reviewing.show_remaining_due_counts) form.showPlayButtons.setChecked(not reviewing.hide_audio_play_buttons) + form.hideColoredButtons.setChecked(not reviewing.hide_colored_buttons) form.interrupt_audio.setChecked(reviewing.interrupt_audio_when_answering) editing = self.prefs.editing @@ -172,6 +173,7 @@ class Preferences(QDialog): reviewing.show_intervals_on_buttons = form.showEstimates.isChecked() reviewing.time_limit_secs = form.timeLimit.value() * 60 reviewing.hide_audio_play_buttons = not self.form.showPlayButtons.isChecked() + reviewing.hide_colored_buttons = not self.form.hideColoredButtons.isChecked() reviewing.interrupt_audio_when_answering = self.form.interrupt_audio.isChecked() editing = self.prefs.editing diff --git a/qt/aqt/reviewer.py b/qt/aqt/reviewer.py index 71859d73a..023f6a184 100644 --- a/qt/aqt/reviewer.py +++ b/qt/aqt/reviewer.py @@ -931,7 +931,20 @@ timerStopped = false; if aqt.mw.pm.get_answer_key(i) else "" ) - return """ + + if self.mw.col.conf["hideColor"]: + return """ +""" % ( + extra, + key, + i, + i, + label, + due, + ) + else: + return """ """ % ( extra, diff --git a/rslib/src/config/bool.rs b/rslib/src/config/bool.rs index c76787cb0..8923b328a 100644 --- a/rslib/src/config/bool.rs +++ b/rslib/src/config/bool.rs @@ -54,6 +54,8 @@ pub enum BoolKey { ShowRemainingDueCountsInStudy, #[strum(to_string = "addToCur")] AddingDefaultsToCurrentDeck, + #[strum(to_string = "hideColor")] + HideColoredButtons, } /// This is a workaround for old clients that used ints to represent boolean @@ -71,6 +73,7 @@ impl Collection { // some keys default to true BoolKey::InterruptAudioWhenAnswering | BoolKey::ShowIntervalsAboveAnswerButtons + | BoolKey::HideColoredButtons | BoolKey::AddingDefaultsToCurrentDeck | BoolKey::FutureDueShowBacklog | BoolKey::ShowRemainingDueCountsInStudy diff --git a/rslib/src/preferences.rs b/rslib/src/preferences.rs index 96be8e461..97be7b02e 100644 --- a/rslib/src/preferences.rs +++ b/rslib/src/preferences.rs @@ -97,6 +97,8 @@ impl Collection { show_remaining_due_counts: self.get_config_bool(BoolKey::ShowRemainingDueCountsInStudy), show_intervals_on_buttons: self .get_config_bool(BoolKey::ShowIntervalsAboveAnswerButtons), + hide_colored_buttons: self + .get_config_bool(BoolKey::HideColoredButtons), time_limit_secs: self.get_answer_time_limit_secs(), load_balancer_enabled: self.get_config_bool(BoolKey::LoadBalancerEnabled), fsrs_short_term_with_steps_enabled: self @@ -119,6 +121,10 @@ impl Collection { BoolKey::ShowIntervalsAboveAnswerButtons, s.show_intervals_on_buttons, )?; + self.set_config_bool_inner( + BoolKey::HideColoredButtons, + s.hide_colored_buttons, + )?; self.set_answer_time_limit_secs(s.time_limit_secs)?; self.set_config_bool_inner(BoolKey::LoadBalancerEnabled, s.load_balancer_enabled)?; self.set_config_bool_inner(