diff --git a/wezterm-gui/src/termwindow/render.rs b/wezterm-gui/src/termwindow/render.rs index 2f8422e6e..6fb19f512 100644 --- a/wezterm-gui/src/termwindow/render.rs +++ b/wezterm-gui/src/termwindow/render.rs @@ -673,38 +673,6 @@ impl super::TermWindow { let bg_is_default = attrs.background == ColorAttribute::Default; let bg_color = params.palette.resolve_bg(attrs.background); - fn resolve_fg_color_attr( - attrs: &CellAttributes, - fg: &ColorAttribute, - params: &RenderScreenLineOpenGLParams, - style: &config::TextStyle, - ) -> RgbColor { - match fg { - wezterm_term::color::ColorAttribute::Default => { - if let Some(fg) = style.foreground { - fg - } else { - params.palette.resolve_fg(attrs.foreground) - } - } - wezterm_term::color::ColorAttribute::PaletteIndex(idx) - if *idx < 8 && params.config.bold_brightens_ansi_colors => - { - // For compatibility purposes, switch to a brighter version - // of one of the standard ANSI colors when Bold is enabled. - // This lifts black to dark grey. - let idx = if attrs.intensity() == wezterm_term::Intensity::Bold { - *idx + 8 - } else { - *idx - }; - params - .palette - .resolve_fg(wezterm_term::color::ColorAttribute::PaletteIndex(idx)) - } - _ => params.palette.resolve_fg(*fg), - } - } let fg_color = resolve_fg_color_attr(&attrs, &attrs.foreground, ¶ms, &style); let (fg_color, bg_color, bg_is_default) = { @@ -1295,3 +1263,36 @@ fn rgbcolor_alpha_to_window_color(color: RgbColor, alpha: u8) -> LinearRgba { // with_srgba. LinearRgba::with_rgba(color.red, color.green, color.blue, alpha) } + +fn resolve_fg_color_attr( + attrs: &CellAttributes, + fg: &ColorAttribute, + params: &RenderScreenLineOpenGLParams, + style: &config::TextStyle, +) -> RgbColor { + match fg { + wezterm_term::color::ColorAttribute::Default => { + if let Some(fg) = style.foreground { + fg + } else { + params.palette.resolve_fg(attrs.foreground) + } + } + wezterm_term::color::ColorAttribute::PaletteIndex(idx) + if *idx < 8 && params.config.bold_brightens_ansi_colors => + { + // For compatibility purposes, switch to a brighter version + // of one of the standard ANSI colors when Bold is enabled. + // This lifts black to dark grey. + let idx = if attrs.intensity() == wezterm_term::Intensity::Bold { + *idx + 8 + } else { + *idx + }; + params + .palette + .resolve_fg(wezterm_term::color::ColorAttribute::PaletteIndex(idx)) + } + _ => params.palette.resolve_fg(*fg), + } +}