mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 03:14:56 +07:00
vim: Add configurable yank highlight background color (#49517)
* Add a dedicated `vim.yank.background` theme color for the yank highlight, which was previously hardcoded to `editor.document_highlight.read_background`. * When a theme doesn't define `vim.yank.background`, it falls back to `editor.document_highlight.read_background` for backwards compatibility. * The VS Code theme importer maps `editor.rangeHighlightBackground` to this new color. Release Notes: - Added configurable `vim.yank.background` theme color for vim yank background highlight --------- Co-authored-by: dino <dinojoaocosta@gmail.com>
This commit is contained in:
parent
10b33f81b7
commit
bf6a737e59
7 changed files with 15 additions and 1 deletions
|
|
@ -1033,6 +1033,9 @@ pub struct ThemeColorsContent {
|
|||
/// Background color for Vim Visual Block mode indicator.
|
||||
#[serde(rename = "vim.visual_block.background")]
|
||||
pub vim_visual_block_background: Option<String>,
|
||||
/// Background color for Vim yank highlight.
|
||||
#[serde(rename = "vim.yank.background")]
|
||||
pub vim_yank_background: Option<String>,
|
||||
/// Background color for Vim Helix Normal mode indicator.
|
||||
#[serde(rename = "vim.helix_normal.background")]
|
||||
pub vim_helix_normal_background: Option<String>,
|
||||
|
|
|
|||
|
|
@ -175,6 +175,7 @@ impl ThemeColors {
|
|||
vim_visual_background: system.transparent,
|
||||
vim_visual_line_background: system.transparent,
|
||||
vim_visual_block_background: system.transparent,
|
||||
vim_yank_background: neutral().light_alpha().step_3(),
|
||||
vim_helix_normal_background: system.transparent,
|
||||
vim_helix_select_background: system.transparent,
|
||||
vim_normal_foreground: system.transparent,
|
||||
|
|
@ -320,6 +321,7 @@ impl ThemeColors {
|
|||
vim_visual_background: system.transparent,
|
||||
vim_visual_line_background: system.transparent,
|
||||
vim_visual_block_background: system.transparent,
|
||||
vim_yank_background: neutral().dark_alpha().step_4(),
|
||||
vim_helix_normal_background: system.transparent,
|
||||
vim_helix_select_background: system.transparent,
|
||||
vim_normal_foreground: system.transparent,
|
||||
|
|
|
|||
|
|
@ -257,6 +257,7 @@ pub(crate) fn zed_default_dark() -> Theme {
|
|||
vim_visual_background: SystemColors::default().transparent,
|
||||
vim_visual_line_background: SystemColors::default().transparent,
|
||||
vim_visual_block_background: SystemColors::default().transparent,
|
||||
vim_yank_background: hsla(207.8 / 360., 81. / 100., 66. / 100., 0.2),
|
||||
vim_helix_normal_background: SystemColors::default().transparent,
|
||||
vim_helix_select_background: SystemColors::default().transparent,
|
||||
vim_normal_foreground: SystemColors::default().transparent,
|
||||
|
|
|
|||
|
|
@ -796,6 +796,11 @@ pub fn theme_colors_refinement(
|
|||
.vim_visual_block_background
|
||||
.as_ref()
|
||||
.and_then(|color| try_parse_color(color).ok()),
|
||||
vim_yank_background: this
|
||||
.vim_yank_background
|
||||
.as_ref()
|
||||
.and_then(|color| try_parse_color(color).ok())
|
||||
.or(editor_document_highlight_read_background),
|
||||
vim_helix_normal_background: this
|
||||
.vim_helix_normal_background
|
||||
.as_ref()
|
||||
|
|
|
|||
|
|
@ -175,6 +175,8 @@ pub struct ThemeColors {
|
|||
pub vim_visual_line_background: Hsla,
|
||||
/// Background color for Vim Visual Block mode indicator.
|
||||
pub vim_visual_block_background: Hsla,
|
||||
/// Background color for Vim yank highlight.
|
||||
pub vim_yank_background: Hsla,
|
||||
/// Background color for Vim Helix Normal mode indicator.
|
||||
pub vim_helix_normal_background: Hsla,
|
||||
/// Background color for Vim Helix Select mode indicator.
|
||||
|
|
|
|||
|
|
@ -207,6 +207,7 @@ impl VsCodeThemeConverter {
|
|||
terminal_ansi_white: vscode_colors.terminal.ansi_white.clone(),
|
||||
terminal_ansi_bright_white: vscode_colors.terminal.ansi_bright_white.clone(),
|
||||
link_text_hover: vscode_colors.text_link.active_foreground.clone(),
|
||||
vim_yank_background: vscode_colors.editor.range_highlight_background.clone(),
|
||||
..Default::default()
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ impl Vim {
|
|||
editor.highlight_background(
|
||||
HighlightKey::HighlightOnYank,
|
||||
&ranges_to_highlight,
|
||||
|_, colors| colors.colors().editor_document_highlight_read_background,
|
||||
|_, colors| colors.colors().vim_yank_background,
|
||||
cx,
|
||||
);
|
||||
cx.spawn(async move |this, cx| {
|
||||
|
|
|
|||
Loading…
Reference in a new issue