From 98720f3d1c4960b7d32856afbd1f82b413ba457d Mon Sep 17 00:00:00 2001 From: Andros Fenollosa Date: Wed, 3 Jun 2026 07:46:59 +0200 Subject: [PATCH] Metal: neutral light fallbacks instead of baked-in Nord colors (F4) The real draw path used Nord theme colors (0x2E3440 bg, 0xECEFF4 fg) as fallbacks for when the frame or face is null. Those paths are effectively unreachable, but baking a dark theme into a backend that mirrors the NS default light theme is wrong if ever hit. Use neutral white bg / black fg instead. The MtlView test window and the offscreen PNG render keep their Nord palette (out of the real redisplay path), per TODO F4. --- src/mtlterm.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mtlterm.m b/src/mtlterm.m index ff9be201de5..c0798d9fe95 100644 --- a/src/mtlterm.m +++ b/src/mtlterm.m @@ -1043,7 +1043,7 @@ easing_apply (MtlScrollEasing mode, float t) - (void)openRenderEncoderClear:(BOOL)clear { struct frame *f = self.emacsFrame; - unsigned long bg = f ? ns_color_to_pixel (FRAME_BACKGROUND_COLOR (f)) : 0x2E3440; + unsigned long bg = f ? ns_color_to_pixel (FRAME_BACKGROUND_COLOR (f)) : 0xFFFFFF; float r, g, b; unpack_color (bg, &r, &g, &b); @@ -1164,7 +1164,7 @@ easing_apply (MtlScrollEasing mode, float t) if (!needsClear && self.pendingClears.count) { struct frame *f = self.emacsFrame; - unsigned long bg = f ? ns_color_to_pixel (FRAME_BACKGROUND_COLOR (f)) : 0x2E3440; + unsigned long bg = f ? ns_color_to_pixel (FRAME_BACKGROUND_COLOR (f)) : 0xFFFFFF; for (NSValue *v in self.pendingClears) [self fillRect:[v rectValue] color:bg]; } @@ -1986,8 +1986,8 @@ mtl_draw_glyph_string_impl (struct glyph_string *s) if (!fd || !fd.encoder) { mtl_dgs_nofd_count++; return; } struct face *face = s->face; - unsigned long fg = face ? face->foreground : 0xECEFF4; - unsigned long bg = face ? face->background : 0x2E3440; + unsigned long fg = face ? face->foreground : 0x000000; + unsigned long bg = face ? face->background : 0xFFFFFF; /* When this string is drawn as the cursor (via draw_phys_cursor_glyph), invert: fill the background with the cursor color and draw the glyph in @@ -1996,7 +1996,7 @@ mtl_draw_glyph_string_impl (struct glyph_string *s) if (s->hl == DRAW_CURSOR) { bg = ns_color_to_pixel (FRAME_CURSOR_COLOR (f)); - fg = face ? face->background : 0x2E3440; + fg = face ? face->background : 0xFFFFFF; } /* Background fill */