Pull editor inlay hints from VS Code themes

This commit is contained in:
Marshall Bowers 2023-12-07 15:36:13 -05:00
parent 6a164db700
commit fa223e0c6f
14 changed files with 61 additions and 1 deletions

View File

@ -58,6 +58,7 @@ pub fn andromeda() -> UserThemeFamily {
deleted: Some(rgba(0xfc634cff).into()),
error: Some(rgba(0xfc634cff).into()),
hidden: Some(rgba(0x746f77ff).into()),
hint: Some(rgba(0x969696ff).into()),
..Default::default()
},
syntax: Some(UserSyntaxTheme {
@ -201,6 +202,7 @@ pub fn andromeda() -> UserThemeFamily {
deleted: Some(rgba(0xfc634cff).into()),
error: Some(rgba(0xfc634cff).into()),
hidden: Some(rgba(0x746f77ff).into()),
hint: Some(rgba(0x969696ff).into()),
..Default::default()
},
syntax: Some(UserSyntaxTheme {

View File

@ -62,6 +62,7 @@ pub fn ayu() -> UserThemeFamily {
deleted: Some(rgba(0xe65050ff).into()),
error: Some(rgba(0xe65050ff).into()),
hidden: Some(rgba(0x8a9199ff).into()),
hint: Some(rgba(0x969696ff).into()),
..Default::default()
},
syntax: Some(UserSyntaxTheme {
@ -324,6 +325,7 @@ pub fn ayu() -> UserThemeFamily {
deleted: Some(rgba(0xff6565ff).into()),
error: Some(rgba(0xff6565ff).into()),
hidden: Some(rgba(0x707a8cff).into()),
hint: Some(rgba(0x969696ff).into()),
..Default::default()
},
syntax: Some(UserSyntaxTheme {
@ -586,6 +588,7 @@ pub fn ayu() -> UserThemeFamily {
deleted: Some(rgba(0xd95757ff).into()),
error: Some(rgba(0xd95757ff).into()),
hidden: Some(rgba(0x565b66ff).into()),
hint: Some(rgba(0x969696ff).into()),
..Default::default()
},
syntax: Some(UserSyntaxTheme {

View File

@ -62,6 +62,7 @@ pub fn dracula() -> UserThemeFamily {
deleted: Some(rgba(0xff5555ff).into()),
error: Some(rgba(0xff5555ff).into()),
hidden: Some(rgba(0x6272a4ff).into()),
hint: Some(rgba(0x969696ff).into()),
warning: Some(rgba(0xffb76bff).into()),
..Default::default()
},

View File

@ -61,6 +61,7 @@ pub fn gruvbox() -> UserThemeFamily {
deleted: Some(rgba(0xfb4833ff).into()),
error: Some(rgba(0xfb4833ff).into()),
hidden: Some(rgba(0xa89984ff).into()),
hint: Some(rgba(0x969696ff).into()),
..Default::default()
},
syntax: Some(UserSyntaxTheme {
@ -251,6 +252,7 @@ pub fn gruvbox() -> UserThemeFamily {
deleted: Some(rgba(0xfb4833ff).into()),
error: Some(rgba(0xfb4833ff).into()),
hidden: Some(rgba(0xa89984ff).into()),
hint: Some(rgba(0x969696ff).into()),
..Default::default()
},
syntax: Some(UserSyntaxTheme {
@ -441,6 +443,7 @@ pub fn gruvbox() -> UserThemeFamily {
deleted: Some(rgba(0xfb4833ff).into()),
error: Some(rgba(0xfb4833ff).into()),
hidden: Some(rgba(0xa89984ff).into()),
hint: Some(rgba(0x969696ff).into()),
..Default::default()
},
syntax: Some(UserSyntaxTheme {
@ -631,6 +634,7 @@ pub fn gruvbox() -> UserThemeFamily {
deleted: Some(rgba(0x9d0006ff).into()),
error: Some(rgba(0x9d0006ff).into()),
hidden: Some(rgba(0x7c6f64ff).into()),
hint: Some(rgba(0x969696ff).into()),
..Default::default()
},
syntax: Some(UserSyntaxTheme {
@ -821,6 +825,7 @@ pub fn gruvbox() -> UserThemeFamily {
deleted: Some(rgba(0x9d0006ff).into()),
error: Some(rgba(0x9d0006ff).into()),
hidden: Some(rgba(0x7c6f64ff).into()),
hint: Some(rgba(0x969696ff).into()),
..Default::default()
},
syntax: Some(UserSyntaxTheme {
@ -1011,6 +1016,7 @@ pub fn gruvbox() -> UserThemeFamily {
deleted: Some(rgba(0x9d0006ff).into()),
error: Some(rgba(0x9d0006ff).into()),
hidden: Some(rgba(0x7c6f64ff).into()),
hint: Some(rgba(0x969696ff).into()),
..Default::default()
},
syntax: Some(UserSyntaxTheme {

View File

@ -62,6 +62,7 @@ pub fn night_owl() -> UserThemeFamily {
deleted: Some(rgba(0xef524fff).into()),
error: Some(rgba(0xef524fff).into()),
hidden: Some(rgba(0x5f7e97ff).into()),
hint: Some(rgba(0x969696ff).into()),
..Default::default()
},
syntax: Some(UserSyntaxTheme {
@ -242,6 +243,7 @@ pub fn night_owl() -> UserThemeFamily {
deleted: Some(rgba(0x403f53ff).into()),
error: Some(rgba(0x403f53ff).into()),
hidden: Some(rgba(0x403f53ff).into()),
hint: Some(rgba(0x969696ff).into()),
warning: Some(rgba(0xdaa900ff).into()),
..Default::default()
},

View File

@ -63,6 +63,7 @@ pub fn noctis() -> UserThemeFamily {
deleted: Some(rgba(0xe34d1bff).into()),
error: Some(rgba(0xe34d1bff).into()),
hidden: Some(rgba(0x9fb6c6ff).into()),
hint: Some(rgba(0x969696ff).into()),
warning: Some(rgba(0xffa857ff).into()),
..Default::default()
},
@ -282,6 +283,7 @@ pub fn noctis() -> UserThemeFamily {
deleted: Some(rgba(0xe34d1bff).into()),
error: Some(rgba(0xe34d1bff).into()),
hidden: Some(rgba(0xbbaab0ff).into()),
hint: Some(rgba(0x969696ff).into()),
warning: Some(rgba(0xffa857ff).into()),
..Default::default()
},
@ -501,6 +503,7 @@ pub fn noctis() -> UserThemeFamily {
deleted: Some(rgba(0xff3f00ff).into()),
error: Some(rgba(0xff3f00ff).into()),
hidden: Some(rgba(0x70838dff).into()),
hint: Some(rgba(0x969696ff).into()),
warning: Some(rgba(0xe07a52ff).into()),
..Default::default()
},
@ -720,6 +723,7 @@ pub fn noctis() -> UserThemeFamily {
deleted: Some(rgba(0xff3f00ff).into()),
error: Some(rgba(0xff3f00ff).into()),
hidden: Some(rgba(0x74708dff).into()),
hint: Some(rgba(0x969696ff).into()),
warning: Some(rgba(0xe07a52ff).into()),
..Default::default()
},
@ -939,6 +943,7 @@ pub fn noctis() -> UserThemeFamily {
deleted: Some(rgba(0xff3f00ff).into()),
error: Some(rgba(0xff3f00ff).into()),
hidden: Some(rgba(0x878476ff).into()),
hint: Some(rgba(0x969696ff).into()),
warning: Some(rgba(0xe07a52ff).into()),
..Default::default()
},
@ -1158,6 +1163,7 @@ pub fn noctis() -> UserThemeFamily {
deleted: Some(rgba(0xb96245ff).into()),
error: Some(rgba(0xb96245ff).into()),
hidden: Some(rgba(0x96a8b6ff).into()),
hint: Some(rgba(0x969696ff).into()),
warning: Some(rgba(0xffa857ff).into()),
..Default::default()
},
@ -1377,6 +1383,7 @@ pub fn noctis() -> UserThemeFamily {
deleted: Some(rgba(0xe34d1bff).into()),
error: Some(rgba(0xe34d1bff).into()),
hidden: Some(rgba(0x87a7abff).into()),
hint: Some(rgba(0x969696ff).into()),
warning: Some(rgba(0xffa487ff).into()),
..Default::default()
},
@ -1596,6 +1603,7 @@ pub fn noctis() -> UserThemeFamily {
deleted: Some(rgba(0xe34d1bff).into()),
error: Some(rgba(0xe34d1bff).into()),
hidden: Some(rgba(0x87a7abff).into()),
hint: Some(rgba(0x969696ff).into()),
warning: Some(rgba(0xffa487ff).into()),
..Default::default()
},
@ -1815,6 +1823,7 @@ pub fn noctis() -> UserThemeFamily {
deleted: Some(rgba(0xe34d1bff).into()),
error: Some(rgba(0xe34d1bff).into()),
hidden: Some(rgba(0x87a7abff).into()),
hint: Some(rgba(0x969696ff).into()),
warning: Some(rgba(0xffa487ff).into()),
..Default::default()
},
@ -2034,6 +2043,7 @@ pub fn noctis() -> UserThemeFamily {
deleted: Some(rgba(0xe34d1bff).into()),
error: Some(rgba(0xe34d1bff).into()),
hidden: Some(rgba(0xa9a5c0ff).into()),
hint: Some(rgba(0x969696ff).into()),
warning: Some(rgba(0xffa857ff).into()),
..Default::default()
},
@ -2253,6 +2263,7 @@ pub fn noctis() -> UserThemeFamily {
deleted: Some(rgba(0xe34d1bff).into()),
error: Some(rgba(0xe34d1bff).into()),
hidden: Some(rgba(0xb3a5c0ff).into()),
hint: Some(rgba(0x969696ff).into()),
warning: Some(rgba(0xffa857ff).into()),
..Default::default()
},

View File

@ -62,6 +62,7 @@ pub fn nord() -> UserThemeFamily {
deleted: Some(rgba(0xbf616aff).into()),
error: Some(rgba(0xbf616aff).into()),
hidden: Some(rgba(0xd8dee966).into()),
hint: Some(rgba(0xd8dee9ff).into()),
warning: Some(rgba(0xebcb8bff).into()),
..Default::default()
},

View File

@ -62,6 +62,7 @@ pub fn palenight() -> UserThemeFamily {
deleted: Some(rgba(0xef524fff).into()),
error: Some(rgba(0xef524fff).into()),
hidden: Some(rgba(0x9199c8ff).into()),
hint: Some(rgba(0x969696ff).into()),
..Default::default()
},
syntax: Some(UserSyntaxTheme {
@ -268,6 +269,7 @@ pub fn palenight() -> UserThemeFamily {
deleted: Some(rgba(0xef524fff).into()),
error: Some(rgba(0xef524fff).into()),
hidden: Some(rgba(0x9199c8ff).into()),
hint: Some(rgba(0x969696ff).into()),
..Default::default()
},
syntax: Some(UserSyntaxTheme {
@ -474,6 +476,7 @@ pub fn palenight() -> UserThemeFamily {
deleted: Some(rgba(0xef524fff).into()),
error: Some(rgba(0xef524fff).into()),
hidden: Some(rgba(0x9199c8ff).into()),
hint: Some(rgba(0x969696ff).into()),
..Default::default()
},
syntax: Some(UserSyntaxTheme {

View File

@ -62,6 +62,7 @@ pub fn rose_pine() -> UserThemeFamily {
deleted: Some(rgba(0xeb6f92ff).into()),
error: Some(rgba(0xeb6f92ff).into()),
hidden: Some(rgba(0x908caaff).into()),
hint: Some(rgba(0x908caaff).into()),
warning: Some(rgba(0xf5c177ff).into()),
..Default::default()
},
@ -228,6 +229,7 @@ pub fn rose_pine() -> UserThemeFamily {
deleted: Some(rgba(0xeb6f92ff).into()),
error: Some(rgba(0xeb6f92ff).into()),
hidden: Some(rgba(0x908caaff).into()),
hint: Some(rgba(0x908caaff).into()),
warning: Some(rgba(0xf5c177ff).into()),
..Default::default()
},
@ -394,6 +396,7 @@ pub fn rose_pine() -> UserThemeFamily {
deleted: Some(rgba(0xb3627aff).into()),
error: Some(rgba(0xb3627aff).into()),
hidden: Some(rgba(0x797593ff).into()),
hint: Some(rgba(0x797593ff).into()),
warning: Some(rgba(0xea9d34ff).into()),
..Default::default()
},

View File

@ -59,6 +59,7 @@ pub fn solarized() -> UserThemeFamily {
deleted: Some(rgba(0xffeaeaff).into()),
error: Some(rgba(0xffeaeaff).into()),
hidden: Some(rgba(0x93a1a1ff).into()),
hint: Some(rgba(0x969696ff).into()),
..Default::default()
},
syntax: Some(UserSyntaxTheme {
@ -243,6 +244,7 @@ pub fn solarized() -> UserThemeFamily {
},
status: StatusColorsRefinement {
hidden: Some(rgba(0x586e75ff).into()),
hint: Some(rgba(0x969696ff).into()),
..Default::default()
},
syntax: Some(UserSyntaxTheme {

View File

@ -47,6 +47,7 @@ pub fn synthwave_84() -> UserThemeFamily {
status: StatusColorsRefinement {
deleted: Some(rgba(0xfe444fff).into()),
error: Some(rgba(0xfe444fff).into()),
hint: Some(rgba(0x969696ff).into()),
warning: Some(rgba(0x71f1b7bb).into()),
..Default::default()
},

View File

@ -283,11 +283,14 @@ impl<'a> Debug for StatusColorsRefinementPrinter<'a> {
("deleted", self.0.deleted),
("error", self.0.error),
("hidden", self.0.hidden),
("hint", self.0.hint),
("ignored", self.0.ignored),
("info", self.0.info),
("modified", self.0.modified),
("predictive", self.0.predictive),
("renamed", self.0.renamed),
("success", self.0.success),
("unreachable", self.0.unreachable),
("warning", self.0.warning),
];

View File

@ -1,5 +1,5 @@
use anyhow::Result;
use gpui::{Hsla, Rgba};
use gpui::{rgba, Hsla, Rgba};
use indexmap::IndexMap;
use strum::IntoEnumIterator;
use theme::{
@ -66,6 +66,11 @@ impl VsCodeThemeConverter {
fn convert_status_colors(&self) -> Result<StatusColorsRefinement> {
let vscode_colors = &self.theme.colors;
let vscode_base_status_colors = StatusColorsRefinement {
hint: Some(rgba(0x969696ff).into()),
..Default::default()
};
Ok(StatusColorsRefinement {
// conflict: None,
// created: None,
@ -81,6 +86,11 @@ impl VsCodeThemeConverter {
.tab_inactive_foreground
.as_ref()
.traverse(|color| try_parse_color(&color))?,
hint: vscode_colors
.editor_inlay_hint_foreground
.as_ref()
.traverse(|color| try_parse_color(&color))?
.or(vscode_base_status_colors.hint),
// ignored: None,
// info: None,
// modified: None,

View File

@ -163,6 +163,18 @@ pub struct VsCodeColors {
pub editor_foreground: Option<String>,
#[serde(rename = "editor.background")]
pub editor_background: Option<String>,
#[serde(rename = "editorInlayHint.foreground")]
pub editor_inlay_hint_foreground: Option<String>,
#[serde(rename = "editorInlayHint.background")]
pub editor_inlay_hint_background: Option<String>,
#[serde(rename = "editorInlayHint.parameterForeground")]
pub editor_inlay_hint_parameter_foreground: Option<String>,
#[serde(rename = "editorInlayHint.parameterBackground")]
pub editor_inlay_hint_parameter_background: Option<String>,
#[serde(rename = "editorInlayHint.typForeground")]
pub editor_inlay_hint_typ_foreground: Option<String>,
#[serde(rename = "editorInlayHint.typBackground")]
pub editor_inlay_hint_typ_background: Option<String>,
#[serde(rename = "editorLineNumber.foreground")]
pub editor_line_number_foreground: Option<String>,
#[serde(rename = "editor.selectionBackground")]