From 85f6372c68b3906bf2ed92e9ff666e2f699ffef2 Mon Sep 17 00:00:00 2001 From: trevyn Date: Sat, 20 Mar 2021 09:14:40 +0400 Subject: [PATCH] Assume at least 8 colors (#565) --- cursive/src/backends/curses/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/cursive/src/backends/curses/mod.rs b/cursive/src/backends/curses/mod.rs index c6c8bf3..8567a2d 100644 --- a/cursive/src/backends/curses/mod.rs +++ b/cursive/src/backends/curses/mod.rs @@ -74,6 +74,7 @@ fn find_closest_pair(pair: ColorPair, max_colors: i16) -> (i16, i16) { /// If `max_colors` is less than 256 (like 8 or 16), the color will be /// downgraded to the closest one available. fn find_closest(color: Color, max_colors: i16) -> i16 { + let max_colors = std::cmp::max(max_colors, 8); match color { Color::TerminalDefault => -1, Color::Dark(BaseColor::Black) => 0,