From 82f3d0c62d06edfdf1c999f65671b9f48e464261 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=98yvind=20Kol=C3=A5s?= <pippin@gimp.org>
Date: Wed, 4 Oct 2023 04:05:29 +0200
Subject: [PATCH] gfx: use a night-mode palette for 4bpp

---
 components/st3m/st3m_gfx.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/components/st3m/st3m_gfx.c b/components/st3m/st3m_gfx.c
index b4542fcf6..73637b89b 100644
--- a/components/st3m/st3m_gfx.c
+++ b/components/st3m/st3m_gfx.c
@@ -274,6 +274,7 @@ static void st3m_gfx_init_palette(st3m_gfx_mode mode) {
             }
             break;
         case 4: {
+#if 0
             // ega palette
             int idx = 0;
             for (int i = 0; i < 2; i++)
@@ -284,6 +285,15 @@ static void st3m_gfx_init_palette(st3m_gfx_mode mode) {
                             st3m_pal[idx++] = (g * 127) * (i * 2);
                             st3m_pal[idx++] = (b * 127) * (i * 2);
                         }
+#else
+            // night-mode
+            for (int i = 0; i < 16; i++) {
+                st3m_pal[i * 3 + 0] = (i * 255) / 15;
+                st3m_pal[i * 3 + 1] = ((i * 255) / 15) / 3;
+                st3m_pal[i * 3 + 2] = ((i * 255) / 15) / 5;
+            }
+            break;
+#endif
         } break;
         case 8:  // grayscale
             for (int i = 0; i < 256; i++) {
-- 
GitLab