Styling option for separating terminal view background from background color (#17611)
Closes #17313 Release Notes: - Added theme styling option to separate terminal background view from terminal background color, for transparent terminal backgrounds
This commit is contained in:
parent
3d69942f71
commit
0070635b4d
6 changed files with 19 additions and 5 deletions
|
@ -75,7 +75,7 @@ pub fn text_style(cx: &mut WindowContext) -> TextStyle {
|
||||||
font_size: theme::get_buffer_font_size(cx).into(),
|
font_size: theme::get_buffer_font_size(cx).into(),
|
||||||
font_style: FontStyle::Normal,
|
font_style: FontStyle::Normal,
|
||||||
line_height: cx.line_height().into(),
|
line_height: cx.line_height().into(),
|
||||||
background_color: Some(theme.colors().terminal_background),
|
background_color: Some(theme.colors().terminal_ansi_background),
|
||||||
white_space: WhiteSpace::Normal,
|
white_space: WhiteSpace::Normal,
|
||||||
truncate: None,
|
truncate: None,
|
||||||
// These are going to be overridden per-cell
|
// These are going to be overridden per-cell
|
||||||
|
|
|
@ -662,7 +662,7 @@ impl Element for TerminalElement {
|
||||||
font_size: font_size.into(),
|
font_size: font_size.into(),
|
||||||
font_style: FontStyle::Normal,
|
font_style: FontStyle::Normal,
|
||||||
line_height: line_height.into(),
|
line_height: line_height.into(),
|
||||||
background_color: Some(theme.colors().terminal_background),
|
background_color: Some(theme.colors().terminal_ansi_background),
|
||||||
white_space: WhiteSpace::Normal,
|
white_space: WhiteSpace::Normal,
|
||||||
truncate: None,
|
truncate: None,
|
||||||
// These are going to be overridden per-cell
|
// These are going to be overridden per-cell
|
||||||
|
@ -778,7 +778,7 @@ impl Element for TerminalElement {
|
||||||
&[TextRun {
|
&[TextRun {
|
||||||
len,
|
len,
|
||||||
font: text_style.font(),
|
font: text_style.font(),
|
||||||
color: theme.colors().terminal_background,
|
color: theme.colors().terminal_ansi_background,
|
||||||
background_color: None,
|
background_color: None,
|
||||||
underline: Default::default(),
|
underline: Default::default(),
|
||||||
strikethrough: None,
|
strikethrough: None,
|
||||||
|
@ -1158,7 +1158,7 @@ pub fn convert_color(fg: &terminal::alacritty_terminal::vte::ansi::Color, theme:
|
||||||
NamedColor::BrightCyan => colors.terminal_ansi_bright_cyan,
|
NamedColor::BrightCyan => colors.terminal_ansi_bright_cyan,
|
||||||
NamedColor::BrightWhite => colors.terminal_ansi_bright_white,
|
NamedColor::BrightWhite => colors.terminal_ansi_bright_white,
|
||||||
NamedColor::Foreground => colors.terminal_foreground,
|
NamedColor::Foreground => colors.terminal_foreground,
|
||||||
NamedColor::Background => colors.terminal_background,
|
NamedColor::Background => colors.terminal_ansi_background,
|
||||||
NamedColor::Cursor => theme.players().local().cursor,
|
NamedColor::Cursor => theme.players().local().cursor,
|
||||||
NamedColor::DimBlack => colors.terminal_ansi_dim_black,
|
NamedColor::DimBlack => colors.terminal_ansi_dim_black,
|
||||||
NamedColor::DimRed => colors.terminal_ansi_dim_red,
|
NamedColor::DimRed => colors.terminal_ansi_dim_red,
|
||||||
|
|
|
@ -84,6 +84,7 @@ impl ThemeColors {
|
||||||
terminal_foreground: black().light().step_12(),
|
terminal_foreground: black().light().step_12(),
|
||||||
terminal_bright_foreground: black().light().step_11(),
|
terminal_bright_foreground: black().light().step_11(),
|
||||||
terminal_dim_foreground: black().light().step_10(),
|
terminal_dim_foreground: black().light().step_10(),
|
||||||
|
terminal_ansi_background: neutral().light().step_1(),
|
||||||
terminal_ansi_bright_black: black().light().step_11(),
|
terminal_ansi_bright_black: black().light().step_11(),
|
||||||
terminal_ansi_bright_red: red().light().step_10(),
|
terminal_ansi_bright_red: red().light().step_10(),
|
||||||
terminal_ansi_bright_green: green().light().step_10(),
|
terminal_ansi_bright_green: green().light().step_10(),
|
||||||
|
@ -179,6 +180,7 @@ impl ThemeColors {
|
||||||
editor_document_highlight_read_background: neutral().dark_alpha().step_4(),
|
editor_document_highlight_read_background: neutral().dark_alpha().step_4(),
|
||||||
editor_document_highlight_write_background: neutral().dark_alpha().step_4(),
|
editor_document_highlight_write_background: neutral().dark_alpha().step_4(),
|
||||||
terminal_background: neutral().dark().step_1(),
|
terminal_background: neutral().dark().step_1(),
|
||||||
|
terminal_ansi_background: neutral().dark().step_1(),
|
||||||
terminal_foreground: white().dark().step_12(),
|
terminal_foreground: white().dark().step_12(),
|
||||||
terminal_bright_foreground: white().dark().step_11(),
|
terminal_bright_foreground: white().dark().step_11(),
|
||||||
terminal_dim_foreground: white().dark().step_10(),
|
terminal_dim_foreground: white().dark().step_10(),
|
||||||
|
|
|
@ -105,6 +105,7 @@ pub(crate) fn one_dark() -> Theme {
|
||||||
|
|
||||||
terminal_background: bg,
|
terminal_background: bg,
|
||||||
// todo("Use one colors for terminal")
|
// todo("Use one colors for terminal")
|
||||||
|
terminal_ansi_background: crate::black().dark().step_12(),
|
||||||
terminal_foreground: crate::white().dark().step_12(),
|
terminal_foreground: crate::white().dark().step_12(),
|
||||||
terminal_bright_foreground: crate::white().dark().step_11(),
|
terminal_bright_foreground: crate::white().dark().step_11(),
|
||||||
terminal_dim_foreground: crate::white().dark().step_10(),
|
terminal_dim_foreground: crate::white().dark().step_10(),
|
||||||
|
|
|
@ -421,6 +421,10 @@ pub struct ThemeColorsContent {
|
||||||
#[serde(rename = "terminal.foreground")]
|
#[serde(rename = "terminal.foreground")]
|
||||||
pub terminal_foreground: Option<String>,
|
pub terminal_foreground: Option<String>,
|
||||||
|
|
||||||
|
/// Terminal ansi background color.
|
||||||
|
#[serde(rename = "terminal.ansi.background")]
|
||||||
|
pub terminal_ansi_background: Option<String>,
|
||||||
|
|
||||||
/// Bright terminal foreground color.
|
/// Bright terminal foreground color.
|
||||||
#[serde(rename = "terminal.bright_foreground")]
|
#[serde(rename = "terminal.bright_foreground")]
|
||||||
pub terminal_bright_foreground: Option<String>,
|
pub terminal_bright_foreground: Option<String>,
|
||||||
|
@ -792,6 +796,10 @@ impl ThemeColorsContent {
|
||||||
.terminal_background
|
.terminal_background
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|color| try_parse_color(color).ok()),
|
.and_then(|color| try_parse_color(color).ok()),
|
||||||
|
terminal_ansi_background: self
|
||||||
|
.terminal_ansi_background
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|color| try_parse_color(color).ok()),
|
||||||
terminal_foreground: self
|
terminal_foreground: self
|
||||||
.terminal_foreground
|
.terminal_foreground
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
|
|
@ -175,7 +175,7 @@ pub struct ThemeColors {
|
||||||
// ===
|
// ===
|
||||||
// Terminal
|
// Terminal
|
||||||
// ===
|
// ===
|
||||||
/// Terminal background color.
|
/// Terminal layout background color.
|
||||||
pub terminal_background: Hsla,
|
pub terminal_background: Hsla,
|
||||||
/// Terminal foreground color.
|
/// Terminal foreground color.
|
||||||
pub terminal_foreground: Hsla,
|
pub terminal_foreground: Hsla,
|
||||||
|
@ -184,6 +184,9 @@ pub struct ThemeColors {
|
||||||
/// Dim terminal foreground color.
|
/// Dim terminal foreground color.
|
||||||
pub terminal_dim_foreground: Hsla,
|
pub terminal_dim_foreground: Hsla,
|
||||||
|
|
||||||
|
/// Terminal ansi background color.
|
||||||
|
pub terminal_ansi_background: Hsla,
|
||||||
|
|
||||||
/// Black ANSI terminal color.
|
/// Black ANSI terminal color.
|
||||||
pub terminal_ansi_black: Hsla,
|
pub terminal_ansi_black: Hsla,
|
||||||
/// Bright black ANSI terminal color.
|
/// Bright black ANSI terminal color.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue