feat(console): persist accent toggle + add monochrome-text toggle

Persist the two console output display preferences and add a second toolbar
toggle for monochrome text.

- Persistence: new Settings fields console_line_accents / console_text_color
  (both default true, matching the ConsoleTab statics so an upgrade re-save
  can't flip visible behavior). Restored into the statics at startup in the App
  constructor, and saved from a diff-and-save after the console renders (only
  when a value actually changed — save() is disk I/O). The startup restore also
  fixes a pre-existing bug: scanline was only synced from settings when the
  Settings page or first-run wizard ran, so an existing wallet ignored a saved
  scanline preference on launch.
- Monochrome text: a new toolbar toggle (FORMAT_COLOR_TEXT, dimmed when off)
  next to the accent toggle. channelTextColor() early-returns the neutral
  COLOR_RESULT for every channel (and JSON syntax role) when off, leaving the
  left accent bars independent. COLOR_RESULT is contrast-floored per theme, so
  text stays readable on light and dark terminals.

Adds console_toggle_text_color to the English source + all 8 translations.
Verified: both toggles independent, persistence round-trips across restart,
monochrome readable on light + dark skins.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-12 16:26:44 -05:00
parent d156dddcd0
commit c40c252c9a
14 changed files with 60 additions and 0 deletions

View File

@@ -45,6 +45,7 @@ ImU32 ConsoleTab::COLOR_INFO = IM_COL32(191, 209, 229, 255);
ImU32 ConsoleTab::COLOR_RPC = IM_COL32(120, 180, 255, 210);
bool ConsoleTab::s_scanline_enabled = true;
bool ConsoleTab::s_line_accents_enabled = true;
bool ConsoleTab::s_line_text_color_enabled = true;
float ConsoleTab::s_console_zoom = 1.0f;
bool ConsoleTab::s_daemon_messages_enabled = true;
bool ConsoleTab::s_errors_only_enabled = false;
@@ -189,6 +190,10 @@ void ConsoleTab::refreshColors()
ImU32 ConsoleTab::channelTextColor(ConsoleChannel channel) const
{
using namespace material;
// Monochrome mode: collapse every channel (and JSON syntax role) to the neutral result-body
// color. COLOR_RESULT is theme-correct (contrast-floored on light terminals in refreshColors),
// so text stays readable. The left accent bars are gated separately and stay independent.
if (!s_line_text_color_enabled) return COLOR_RESULT;
switch (channel) {
// COLOR_* channels are already palette-derived + contrast-floored in refreshColors(). The
// roles below are computed live from the theme palette, so floor them to a readable contrast on
@@ -560,6 +565,18 @@ void ConsoleTab::renderToolbar(ConsoleCommandExecutor& exec)
if (ImGui::IsItemHovered()) material::Tooltip("%s", TR("console_toggle_accents"));
}
// Text-color toggle: colored per-channel text vs. monochrome (grouped with the accent toggle).
ImGui::SameLine();
{
float btnSz = ImGui::GetFrameHeight();
if (!s_line_text_color_enabled)
ImGui::PushStyleColor(ImGuiCol_Text, ImGui::ColorConvertU32ToFloat4(OnSurfaceDisabled()));
if (TactileButton(ICON_MD_FORMAT_COLOR_TEXT, ImVec2(btnSz, btnSz), Type().iconMed()))
s_line_text_color_enabled = !s_line_text_color_enabled;
if (!s_line_text_color_enabled) ImGui::PopStyleColor();
if (ImGui::IsItemHovered()) material::Tooltip("%s", TR("console_toggle_text_color"));
}
// Zoom +/- buttons (right side of toolbar)
ImGui::SameLine();
ImGui::Spacing();

View File

@@ -72,6 +72,9 @@ public:
// Draw the per-line left color accent bars (channel-colored). Toggled from the toolbar.
static bool s_line_accents_enabled;
// Color output text per channel. When false the console is monochrome text. Toolbar-toggled.
static bool s_line_text_color_enabled;
// Show/hide daemon output messages
static bool s_daemon_messages_enabled;