diff --git a/src/ncurses_refs.c b/src/ncurses_refs.c
index ed1a4c36cd4357c254f3c8ee282aefa20f57cb56..bcaeb3d2f055e2f61b2720293bf1af404ff24385 100644
--- a/src/ncurses_refs.c
+++ b/src/ncurses_refs.c
@@ -21,3 +21,6 @@ chtype ncdu_acs_urcorner() { return ACS_URCORNER; }
 chtype ncdu_acs_lrcorner() { return ACS_LRCORNER; }
 chtype ncdu_acs_hline()    { return ACS_VLINE   ; }
 chtype ncdu_acs_vline()    { return ACS_HLINE   ; }
+
+/* https://github.com/ziglang/zig/issues/8947 */
+void ncdu_init_pair(short a,b,c) { init_pair(a,b,c); }
diff --git a/src/ui.zig b/src/ui.zig
index 3f3129f40a64279e5463077b079c5413d0e6507e..3c7e0ab6342001606e59007a9df39b0299cfabf3 100644
--- a/src/ui.zig
+++ b/src/ui.zig
@@ -184,6 +184,7 @@ extern fn ncdu_acs_urcorner() c.chtype;
 extern fn ncdu_acs_lrcorner() c.chtype;
 extern fn ncdu_acs_hline()    c.chtype;
 extern fn ncdu_acs_vline()    c.chtype;
+extern fn ncdu_init_pair(idx: c_short, fg: c_short, bg: c_short) void;
 
 const StyleAttr = struct { fg: i16, bg: i16, attr: u32 };
 const StyleDef = struct {
@@ -334,7 +335,7 @@ pub fn init() void {
 
     _ = c.start_color();
     _ = c.use_default_colors();
-    for (styles) |s, i| _ = c.init_pair(@intCast(i16, i+1), s.style().fg, s.style().bg);
+    for (styles) |s, i| _ = ncdu_init_pair(@intCast(i16, i+1), s.style().fg, s.style().bg);
 
     inited = true;
 }