From ab6b3adb2b23dd881176cf9e03f42a1ad221b292 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Fri, 5 May 2023 10:37:29 -0400 Subject: [PATCH] Add a theme entry for whitespace, use it to style whitespaces Co-Authored-By: Antonio Scandurra Co-Authored-By: Kirill Bulatov --- crates/editor/src/element.rs | 2 +- crates/theme/src/theme.rs | 1 + styles/src/styleTree/editor.ts | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 326963a0a5..a3ad392547 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -2202,7 +2202,7 @@ impl Element for EditorElement { let invisible_symbol_font_size = self.style.text.font_size / 2.0; let invisible_symbol_style = RunStyle { - color: self.style.line_number, + color: self.style.whitespace, font_id: self.style.text.font_id, underline: Default::default(), }; diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index 1211f53742..fb6bd85f02 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -636,6 +636,7 @@ pub struct Editor { pub composition_mark: HighlightStyle, pub jump_icon: Interactive, pub scrollbar: Scrollbar, + pub whitespace: Color, } #[derive(Clone, Deserialize, Default)] diff --git a/styles/src/styleTree/editor.ts b/styles/src/styleTree/editor.ts index cd0adf6bc7..7caa8b1c67 100644 --- a/styles/src/styleTree/editor.ts +++ b/styles/src/styleTree/editor.ts @@ -3,7 +3,7 @@ import { ColorScheme, Layer, StyleSets } from "../themes/common/colorScheme" import { background, border, borderColor, foreground, text } from "./components" import hoverPopover from "./hoverPopover" -import { buildSyntax } from "../themes/common/syntax" +import { SyntaxHighlightStyle, buildSyntax } from "../themes/common/syntax" export default function editor(colorScheme: ColorScheme) { let layer = colorScheme.highest @@ -123,6 +123,7 @@ export default function editor(colorScheme: ColorScheme) { renameFade: 0.6, unnecessaryCodeFade: 0.5, selection: colorScheme.players[0], + whitespace: colorScheme.ramps.neutral(0.5).hex(), guestSelections: [ colorScheme.players[1], colorScheme.players[2],