From 21408db9570fe2a48a6ea399003ebb6eff4837bf Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Mon, 20 Jul 2026 00:27:27 +0000 Subject: [PATCH 50/71] fix(macos): don't use the _rgb literal in Themes (GCC -fext-numeric-literals) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Themes.cpp used the engine's operator""_rgb user-defined literal (e.g. 0xf5f5f5_rgb). GCC treats a UDL on an integer literal as a numeric-literal operator, which it only enables under -fext-numeric-literals — off in strict C++ modes. The engine's own translation units pass that flag; contour_macos does not, so the literal was "unable to find numeric literal operator". Use the equivalent explicit ctor vtbackend::RGBColor{0xRRGGBB} instead, which needs no flag and does the same >>16/>>8/&0xFF split. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01AeG2jwYMX5gdvvtUnx3PJa --- src/contour_macos/Themes.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/contour_macos/Themes.cpp b/src/contour_macos/Themes.cpp index 591153ab..337b448d 100644 --- a/src/contour_macos/Themes.cpp +++ b/src/contour_macos/Themes.cpp @@ -33,20 +33,25 @@ ColorPalette paletteFor(Theme theme) // Light theme: dark text on a near-white background. The 16 ANSI colors are kept (they are // tuned to read on either background), but the standard-white/standard-black entries are // darkened/lightened so "white" text is not invisible on white and "bright black" stays legible. - palette.defaultForeground = 0x1a1a1a_rgb; - palette.defaultBackground = 0xf5f5f5_rgb; - palette.defaultForegroundBright = 0x000000_rgb; - palette.defaultForegroundDimmed = 0x606060_rgb; + // + // NB: use RGBColor{uint32_t} rather than the _rgb user-defined literal. GCC treats operator""_rgb + // on an integer literal as a numeric-literal operator, which requires -fext-numeric-literals (off + // in strict C++). The engine's own TUs enable it; contour_macos does not, so the UDL is + // unavailable here. The explicit ctor is exactly equivalent (same >>16/>>8/&0xFF split). + palette.defaultForeground = vtbackend::RGBColor { 0x1a1a1a }; + palette.defaultBackground = vtbackend::RGBColor { 0xf5f5f5 }; + palette.defaultForegroundBright = vtbackend::RGBColor { 0x000000 }; + palette.defaultForegroundDimmed = vtbackend::RGBColor { 0x606060 }; // ANSI white (index 7) and bright-white (15) would be near-invisible on a light background; // pull them toward grey so a program that prints in "white" is still readable. - palette.palette[7] = 0x5a5a5a_rgb; // normal white -> mid grey - palette.palette[15] = 0x2a2a2a_rgb; // bright white -> dark grey + palette.palette[7] = vtbackend::RGBColor { 0x5a5a5a }; // normal white -> mid grey + palette.palette[15] = vtbackend::RGBColor { 0x2a2a2a }; // bright white -> dark grey // Bright-black (index 8) is used as a subtle grey; on light bg lighten it slightly. - palette.palette[8] = 0x8a8a8a_rgb; + palette.palette[8] = vtbackend::RGBColor { 0x8a8a8a }; // Selection: a light-blue wash reads better than the dark-theme blue on a white background. - palette.selection.background = 0x99c0ff_rgb; + palette.selection.background = vtbackend::RGBColor { 0x99c0ff }; palette.selection.backgroundAlpha = 0.5f; return palette;