feat(console): terminal polish — lite/color-coded toggles, dark bg, monospace font
Work through the console items in todo.md: - Lite filter toggles (#5): replace the single hasLogFilters() bool with a ConsoleLogFilterCaps struct so each backend advertises which toggles apply. Full node = daemon/errors/rpc-trace/app; lite = errors-only + app (its diagnostics ring maps to the App/Error channels; the text filter is always shown). Lite previously showed no toggles at all. - Color-coded toggles (#6): each filter checkbox is tinted with its channel's accent color (daemon=blue, errors=red, rpc=secondary, app=teal) via a new channelAccentColor() that also drives the output's left accent bar — one source of truth for channel color. - Darker terminal look (#7): drop the light glass rectangle on the input; both output and input now get a terminal-dark overlay (tabs.console.bg-darken-alpha, default 110) and the input field blends into it (transparent frame bg). - Monospace font (#8): bundle Ubuntu Mono (res/fonts/UbuntuMono-R.ttf, Ubuntu Font License — same family as the existing Ubuntu fonts) via INCBIN, load it at caption size as Type().mono(), and render console output + input in it so pretty-printed JSON columns and terminal text align. Falls back to the proportional caption font if unavailable. Full-node + lite build clean; ctest green; source hygiene clean; sandboxed startup smoke confirms the mono font loads + atlas builds without crashing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -183,7 +183,11 @@ bool Typography::load(ImGuiIO& io, float dpiScale)
|
||||
|
||||
// ButtonLg: Medium
|
||||
fonts_[14] = loadFont(io, kWeightMedium, Layout::kFontButtonLg() * scale, "ButtonLg");
|
||||
|
||||
|
||||
// Monospace (Ubuntu Mono) at caption size — used by the console so terminal text +
|
||||
// pretty-printed JSON columns align. Same size as Caption to keep line heights matched.
|
||||
mono_ = loadFont(io, kWeightMono, Layout::kFontCaption() * scale, "Mono");
|
||||
|
||||
// --- Icon fonts at multiple sizes ---
|
||||
// These are standalone fonts (not merged) so we can PushFont(iconXxx) for icon rendering.
|
||||
iconFonts_[0] = loadIconFont(io, 14.0f * scale, "IconSmall");
|
||||
@@ -236,6 +240,10 @@ ImFont* Typography::loadFont(ImGuiIO& io, int weight, float size, const char* na
|
||||
fontData = g_ubuntu_medium_data;
|
||||
fontDataLen = g_ubuntu_medium_size;
|
||||
break;
|
||||
case kWeightMono:
|
||||
fontData = g_ubuntu_mono_data;
|
||||
fontDataLen = g_ubuntu_mono_size;
|
||||
break;
|
||||
case kWeightRegular:
|
||||
default:
|
||||
fontData = g_ubuntu_regular_data;
|
||||
@@ -271,10 +279,10 @@ ImFont* Typography::loadFont(ImGuiIO& io, int weight, float size, const char* na
|
||||
cfg.GlyphRanges = glyphRanges;
|
||||
|
||||
// Create a unique name for this font variant
|
||||
snprintf(cfg.Name, sizeof(cfg.Name), "Ubuntu %s %.0fpx",
|
||||
weight == kWeightLight ? "Light" :
|
||||
weight == kWeightMedium ? "Medium" : "Regular",
|
||||
size);
|
||||
const char* weightName = weight == kWeightLight ? "Light" :
|
||||
weight == kWeightMedium ? "Medium" :
|
||||
weight == kWeightMono ? "Mono" : "Regular";
|
||||
snprintf(cfg.Name, sizeof(cfg.Name), "Ubuntu %s %.0fpx", weightName, size);
|
||||
|
||||
ImFont* font = io.Fonts->AddFontFromMemoryTTF(fontDataCopy, fontDataLen, size, &cfg);
|
||||
|
||||
|
||||
@@ -168,6 +168,10 @@ public:
|
||||
ImFont* caption() const { return getFont(TypeStyle::Caption); }
|
||||
ImFont* overline() const { return getFont(TypeStyle::Overline); }
|
||||
|
||||
// Monospace (Ubuntu Mono) at caption size — for the console, so JSON/columns align
|
||||
// like a real terminal. Falls back to the proportional caption font if not loaded.
|
||||
ImFont* mono() const { return mono_ ? mono_ : caption(); }
|
||||
|
||||
// Icon fonts — Material Design Icons merged at specific pixel sizes
|
||||
// Use these when you need to render an icon at a specific size via AddText/ImGui::Text.
|
||||
// Common sizes: iconSmall (14px), iconMed (18px), iconLarge (24px).
|
||||
@@ -253,12 +257,16 @@ private:
|
||||
static constexpr int kWeightLight = 300;
|
||||
static constexpr int kWeightRegular = 400;
|
||||
static constexpr int kWeightMedium = 500;
|
||||
static constexpr int kWeightMono = 401; // selects Ubuntu Mono (monospace, regular)
|
||||
|
||||
bool loaded_ = false;
|
||||
float dpiScale_ = 1.0f;
|
||||
|
||||
// Fonts for each type style
|
||||
ImFont* fonts_[15] = {};
|
||||
|
||||
// Monospace font (Ubuntu Mono) at caption size — console/terminal text.
|
||||
ImFont* mono_ = nullptr;
|
||||
|
||||
// Icon fonts at different sizes: [0]=small(14), [1]=med(18), [2]=large(24), [3]=xl(40)
|
||||
ImFont* iconFonts_[4] = {};
|
||||
|
||||
Reference in New Issue
Block a user