Skip to content

Commit f4bc03d

Browse files
tui: fix off-by-16 in terminal_palette (#4967)
caught by a bad refactor in #4957
1 parent 3c5e12e commit f4bc03d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

codex-rs/tui/src/terminal_palette.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub fn best_color(target: (u8, u8, u8)) -> Color {
1111
#[allow(clippy::disallowed_methods)]
1212
Color::Rgb(r, g, b)
1313
} else if color_level.has_256
14-
&& let Some((i, _)) = xterm_fixed_colors().enumerate().min_by(|(_, a), (_, b)| {
14+
&& let Some((i, _)) = xterm_fixed_colors().min_by(|(_, a), (_, b)| {
1515
perceptual_distance(*a, target)
1616
.partial_cmp(&perceptual_distance(*b, target))
1717
.unwrap_or(std::cmp::Ordering::Equal)
@@ -236,8 +236,8 @@ mod imp {
236236
}
237237

238238
/// The subset of Xterm colors that are usually consistent across terminals.
239-
pub fn xterm_fixed_colors() -> impl Iterator<Item = (u8, u8, u8)> {
240-
XTERM_COLORS.into_iter().skip(16)
239+
fn xterm_fixed_colors() -> impl Iterator<Item = (usize, (u8, u8, u8))> {
240+
XTERM_COLORS.into_iter().enumerate().skip(16)
241241
}
242242

243243
// Xterm colors; derived from https://ss64.com/bash/syntax-colors.html

0 commit comments

Comments
 (0)