1use std::fmt::Display;
2use std::num;
3
4use collections::HashMap;
5use schemars::JsonSchema;
6use serde::{Deserialize, Serialize};
7use serde_with::skip_serializing_none;
8use settings_macros::MergeFrom;
9
10use crate::{DelayMs, DiagnosticSeverityContent, ShowScrollbar};
11
12#[skip_serializing_none]
13#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, MergeFrom)]
14pub struct EditorSettingsContent {
15 /// Whether the cursor blinks in the editor.
16 ///
17 /// Default: true
18 pub cursor_blink: Option<bool>,
19 /// Cursor shape for the default editor.
20 /// Can be "bar", "block", "underline", or "hollow".
21 ///
22 /// Default: bar
23 pub cursor_shape: Option<CursorShape>,
24 /// Determines when the mouse cursor should be hidden in an editor or input box.
25 ///
26 /// Default: on_typing_and_movement
27 pub hide_mouse: Option<HideMouseMode>,
28 /// Determines how snippets are sorted relative to other completion items.
29 ///
30 /// Default: inline
31 pub snippet_sort_order: Option<SnippetSortOrder>,
32 /// How to highlight the current line in the editor.
33 ///
34 /// Default: all
35 pub current_line_highlight: Option<CurrentLineHighlight>,
36 /// Whether to highlight all occurrences of the selected text in an editor.
37 ///
38 /// Default: true
39 pub selection_highlight: Option<bool>,
40 /// Whether the text selection should have rounded corners.
41 ///
42 /// Default: true
43 pub rounded_selection: Option<bool>,
44 /// The debounce delay before querying highlights from the language
45 /// server based on the current cursor location.
46 ///
47 /// Default: 75
48 pub lsp_highlight_debounce: Option<DelayMs>,
49 /// Whether to show the informational hover box when moving the mouse
50 /// over symbols in the editor.
51 ///
52 /// Default: true
53 pub hover_popover_enabled: Option<bool>,
54 /// Time to wait in milliseconds before showing the informational hover box.
55 ///
56 /// Default: 300
57 pub hover_popover_delay: Option<DelayMs>,
58 /// Toolbar related settings
59 pub toolbar: Option<ToolbarContent>,
60 /// Scrollbar related settings
61 pub scrollbar: Option<ScrollbarContent>,
62 /// Minimap related settings
63 pub minimap: Option<MinimapContent>,
64 /// Gutter related settings
65 pub gutter: Option<GutterContent>,
66 /// Whether the editor will scroll beyond the last line.
67 ///
68 /// Default: one_page
69 pub scroll_beyond_last_line: Option<ScrollBeyondLastLine>,
70 /// The number of lines to keep above/below the cursor when auto-scrolling.
71 ///
72 /// Default: 3.
73 pub vertical_scroll_margin: Option<f32>,
74 /// Whether to scroll when clicking near the edge of the visible text area.
75 ///
76 /// Default: false
77 pub autoscroll_on_clicks: Option<bool>,
78 /// The number of characters to keep on either side when scrolling with the mouse.
79 ///
80 /// Default: 5.
81 pub horizontal_scroll_margin: Option<f32>,
82 /// Scroll sensitivity multiplier. This multiplier is applied
83 /// to both the horizontal and vertical delta values while scrolling.
84 ///
85 /// Default: 1.0
86 pub scroll_sensitivity: Option<f32>,
87 /// Scroll sensitivity multiplier for fast scrolling. This multiplier is applied
88 /// to both the horizontal and vertical delta values while scrolling. Fast scrolling
89 /// happens when a user holds the alt or option key while scrolling.
90 ///
91 /// Default: 4.0
92 pub fast_scroll_sensitivity: Option<f32>,
93 /// Whether the line numbers on editors gutter are relative or not.
94 ///
95 /// Default: false
96 pub relative_line_numbers: Option<bool>,
97 /// When to populate a new search's query based on the text under the cursor.
98 ///
99 /// Default: always
100 pub seed_search_query_from_cursor: Option<SeedQuerySetting>,
101 pub use_smartcase_search: Option<bool>,
102 /// Determines the modifier to be used to add multiple cursors with the mouse. The open hover link mouse gestures will adapt such that it do not conflict with the multicursor modifier.
103 ///
104 /// Default: alt
105 pub multi_cursor_modifier: Option<MultiCursorModifier>,
106 /// Hide the values of variables in `private` files, as defined by the
107 /// private_files setting. This only changes the visual representation,
108 /// the values are still present in the file and can be selected / copied / pasted
109 ///
110 /// Default: false
111 pub redact_private_values: Option<bool>,
112
113 /// How many lines to expand the multibuffer excerpts by default
114 ///
115 /// Default: 3
116 pub expand_excerpt_lines: Option<u32>,
117
118 /// How many lines of context to provide in multibuffer excerpts by default
119 ///
120 /// Default: 2
121 pub excerpt_context_lines: Option<u32>,
122
123 /// Whether to enable middle-click paste on Linux
124 ///
125 /// Default: true
126 pub middle_click_paste: Option<bool>,
127
128 /// What to do when multibuffer is double clicked in some of its excerpts
129 /// (parts of singleton buffers).
130 ///
131 /// Default: select
132 pub double_click_in_multibuffer: Option<DoubleClickInMultibuffer>,
133 /// Whether the editor search results will loop
134 ///
135 /// Default: true
136 pub search_wrap: Option<bool>,
137
138 /// Defaults to use when opening a new buffer and project search items.
139 ///
140 /// Default: nothing is enabled
141 pub search: Option<SearchSettingsContent>,
142
143 /// Whether to automatically show a signature help pop-up or not.
144 ///
145 /// Default: false
146 pub auto_signature_help: Option<bool>,
147
148 /// Whether to show the signature help pop-up after completions or bracket pairs inserted.
149 ///
150 /// Default: false
151 pub show_signature_help_after_edits: Option<bool>,
152 /// The minimum APCA perceptual contrast to maintain when
153 /// rendering text over highlight backgrounds in the editor.
154 ///
155 /// Values range from 0 to 106. Set to 0 to disable adjustments.
156 /// Default: 45
157 #[schemars(range(min = 0, max = 106))]
158 pub minimum_contrast_for_highlights: Option<MinimumContrast>,
159
160 /// Whether to follow-up empty go to definition responses from the language server or not.
161 /// `FindAllReferences` allows to look up references of the same symbol instead.
162 /// `None` disables the fallback.
163 ///
164 /// Default: FindAllReferences
165 pub go_to_definition_fallback: Option<GoToDefinitionFallback>,
166
167 /// Jupyter REPL settings.
168 pub jupyter: Option<JupyterContent>,
169
170 /// Which level to use to filter out diagnostics displayed in the editor.
171 ///
172 /// Affects the editor rendering only, and does not interrupt
173 /// the functionality of diagnostics fetching and project diagnostics editor.
174 /// Which files containing diagnostic errors/warnings to mark in the tabs.
175 /// Diagnostics are only shown when file icons are also active.
176 ///
177 /// Shows all diagnostics if not specified.
178 ///
179 /// Default: warning
180 pub diagnostics_max_severity: Option<DiagnosticSeverityContent>,
181
182 /// Whether to show code action button at start of buffer line.
183 ///
184 /// Default: true
185 pub inline_code_actions: Option<bool>,
186
187 /// Drag and drop related settings
188 pub drag_and_drop_selection: Option<DragAndDropSelectionContent>,
189
190 /// How to render LSP `textDocument/documentColor` colors in the editor.
191 ///
192 /// Default: [`DocumentColorsRenderMode::Inlay`]
193 pub lsp_document_colors: Option<DocumentColorsRenderMode>,
194}
195
196// Toolbar related settings
197#[skip_serializing_none]
198#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq)]
199pub struct ToolbarContent {
200 /// Whether to display breadcrumbs in the editor toolbar.
201 ///
202 /// Default: true
203 pub breadcrumbs: Option<bool>,
204 /// Whether to display quick action buttons in the editor toolbar.
205 ///
206 /// Default: true
207 pub quick_actions: Option<bool>,
208 /// Whether to show the selections menu in the editor toolbar.
209 ///
210 /// Default: true
211 pub selections_menu: Option<bool>,
212 /// Whether to display Agent review buttons in the editor toolbar.
213 /// Only applicable while reviewing a file edited by the Agent.
214 ///
215 /// Default: true
216 pub agent_review: Option<bool>,
217 /// Whether to display code action buttons in the editor toolbar.
218 ///
219 /// Default: false
220 pub code_actions: Option<bool>,
221}
222
223/// Scrollbar related settings
224#[skip_serializing_none]
225#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Default)]
226pub struct ScrollbarContent {
227 /// When to show the scrollbar in the editor.
228 ///
229 /// Default: auto
230 pub show: Option<ShowScrollbar>,
231 /// Whether to show git diff indicators in the scrollbar.
232 ///
233 /// Default: true
234 pub git_diff: Option<bool>,
235 /// Whether to show buffer search result indicators in the scrollbar.
236 ///
237 /// Default: true
238 pub search_results: Option<bool>,
239 /// Whether to show selected text occurrences in the scrollbar.
240 ///
241 /// Default: true
242 pub selected_text: Option<bool>,
243 /// Whether to show selected symbol occurrences in the scrollbar.
244 ///
245 /// Default: true
246 pub selected_symbol: Option<bool>,
247 /// Which diagnostic indicators to show in the scrollbar:
248 ///
249 /// Default: all
250 pub diagnostics: Option<ScrollbarDiagnostics>,
251 /// Whether to show cursor positions in the scrollbar.
252 ///
253 /// Default: true
254 pub cursors: Option<bool>,
255 /// Forcefully enable or disable the scrollbar for each axis
256 pub axes: Option<ScrollbarAxesContent>,
257}
258
259/// Minimap related settings
260#[skip_serializing_none]
261#[derive(Clone, Default, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq)]
262pub struct MinimapContent {
263 /// When to show the minimap in the editor.
264 ///
265 /// Default: never
266 pub show: Option<ShowMinimap>,
267
268 /// Where to show the minimap in the editor.
269 ///
270 /// Default: [`DisplayIn::ActiveEditor`]
271 pub display_in: Option<DisplayIn>,
272
273 /// When to show the minimap thumb.
274 ///
275 /// Default: always
276 pub thumb: Option<MinimapThumb>,
277
278 /// Defines the border style for the minimap's scrollbar thumb.
279 ///
280 /// Default: left_open
281 pub thumb_border: Option<MinimapThumbBorder>,
282
283 /// How to highlight the current line in the minimap.
284 ///
285 /// Default: inherits editor line highlights setting
286 pub current_line_highlight: Option<CurrentLineHighlight>,
287
288 /// Maximum number of columns to display in the minimap.
289 ///
290 /// Default: 80
291 pub max_width_columns: Option<num::NonZeroU32>,
292}
293
294/// Forcefully enable or disable the scrollbar for each axis
295#[skip_serializing_none]
296#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Default)]
297pub struct ScrollbarAxesContent {
298 /// When false, forcefully disables the horizontal scrollbar. Otherwise, obey other settings.
299 ///
300 /// Default: true
301 pub horizontal: Option<bool>,
302
303 /// When false, forcefully disables the vertical scrollbar. Otherwise, obey other settings.
304 ///
305 /// Default: true
306 pub vertical: Option<bool>,
307}
308
309/// Gutter related settings
310#[skip_serializing_none]
311#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq)]
312pub struct GutterContent {
313 /// Whether to show line numbers in the gutter.
314 ///
315 /// Default: true
316 pub line_numbers: Option<bool>,
317 /// Minimum number of characters to reserve space for in the gutter.
318 ///
319 /// Default: 4
320 pub min_line_number_digits: Option<usize>,
321 /// Whether to show runnable buttons in the gutter.
322 ///
323 /// Default: true
324 pub runnables: Option<bool>,
325 /// Whether to show breakpoints in the gutter.
326 ///
327 /// Default: true
328 pub breakpoints: Option<bool>,
329 /// Whether to show fold buttons in the gutter.
330 ///
331 /// Default: true
332 pub folds: Option<bool>,
333}
334
335/// How to render LSP `textDocument/documentColor` colors in the editor.
336#[derive(
337 Copy,
338 Clone,
339 Debug,
340 Default,
341 Serialize,
342 Deserialize,
343 PartialEq,
344 Eq,
345 JsonSchema,
346 MergeFrom,
347 strum::VariantArray,
348 strum::VariantNames,
349)]
350#[serde(rename_all = "snake_case")]
351pub enum DocumentColorsRenderMode {
352 /// Do not query and render document colors.
353 None,
354 /// Render document colors as inlay hints near the color text.
355 #[default]
356 Inlay,
357 /// Draw a border around the color text.
358 Border,
359 /// Draw a background behind the color text.
360 Background,
361}
362
363#[derive(
364 Copy,
365 Clone,
366 Debug,
367 Serialize,
368 Deserialize,
369 PartialEq,
370 Eq,
371 JsonSchema,
372 MergeFrom,
373 strum::VariantArray,
374 strum::VariantNames,
375)]
376#[serde(rename_all = "snake_case")]
377pub enum CurrentLineHighlight {
378 // Don't highlight the current line.
379 None,
380 // Highlight the gutter area.
381 Gutter,
382 // Highlight the editor area.
383 Line,
384 // Highlight the full line.
385 All,
386}
387
388/// When to populate a new search's query based on the text under the cursor.
389#[derive(
390 Copy,
391 Clone,
392 Debug,
393 Serialize,
394 Deserialize,
395 PartialEq,
396 Eq,
397 JsonSchema,
398 MergeFrom,
399 strum::VariantArray,
400 strum::VariantNames,
401)]
402#[serde(rename_all = "snake_case")]
403pub enum SeedQuerySetting {
404 /// Always populate the search query with the word under the cursor.
405 Always,
406 /// Only populate the search query when there is text selected.
407 Selection,
408 /// Never populate the search query
409 Never,
410}
411
412/// What to do when multibuffer is double clicked in some of its excerpts (parts of singleton buffers).
413#[derive(
414 Default,
415 Copy,
416 Clone,
417 Debug,
418 Serialize,
419 Deserialize,
420 PartialEq,
421 Eq,
422 JsonSchema,
423 MergeFrom,
424 strum::VariantArray,
425 strum::VariantNames,
426)]
427#[serde(rename_all = "snake_case")]
428pub enum DoubleClickInMultibuffer {
429 /// Behave as a regular buffer and select the whole word.
430 #[default]
431 Select,
432 /// Open the excerpt clicked as a new buffer in the new tab, if no `alt` modifier was pressed during double click.
433 /// Otherwise, behave as a regular buffer and select the whole word.
434 Open,
435}
436
437/// When to show the minimap thumb.
438///
439/// Default: always
440#[derive(
441 Copy,
442 Clone,
443 Debug,
444 Default,
445 Serialize,
446 Deserialize,
447 JsonSchema,
448 MergeFrom,
449 PartialEq,
450 Eq,
451 strum::VariantArray,
452 strum::VariantNames,
453)]
454#[serde(rename_all = "snake_case")]
455pub enum MinimapThumb {
456 /// Show the minimap thumb only when the mouse is hovering over the minimap.
457 Hover,
458 /// Always show the minimap thumb.
459 #[default]
460 Always,
461}
462
463/// Defines the border style for the minimap's scrollbar thumb.
464///
465/// Default: left_open
466#[derive(
467 Copy,
468 Clone,
469 Debug,
470 Default,
471 Serialize,
472 Deserialize,
473 JsonSchema,
474 MergeFrom,
475 PartialEq,
476 Eq,
477 strum::VariantArray,
478 strum::VariantNames,
479)]
480#[serde(rename_all = "snake_case")]
481pub enum MinimapThumbBorder {
482 /// Displays a border on all sides of the thumb.
483 Full,
484 /// Displays a border on all sides except the left side of the thumb.
485 #[default]
486 LeftOpen,
487 /// Displays a border on all sides except the right side of the thumb.
488 RightOpen,
489 /// Displays a border only on the left side of the thumb.
490 LeftOnly,
491 /// Displays the thumb without any border.
492 None,
493}
494
495/// Which diagnostic indicators to show in the scrollbar.
496///
497/// Default: all
498#[derive(
499 Copy,
500 Clone,
501 Debug,
502 Serialize,
503 Deserialize,
504 JsonSchema,
505 MergeFrom,
506 PartialEq,
507 Eq,
508 strum::VariantArray,
509 strum::VariantNames,
510)]
511#[serde(rename_all = "lowercase")]
512pub enum ScrollbarDiagnostics {
513 /// Show all diagnostic levels: hint, information, warnings, error.
514 All,
515 /// Show only the following diagnostic levels: information, warning, error.
516 Information,
517 /// Show only the following diagnostic levels: warning, error.
518 Warning,
519 /// Show only the following diagnostic level: error.
520 Error,
521 /// Do not show diagnostics.
522 None,
523}
524
525/// The key to use for adding multiple cursors
526///
527/// Default: alt
528#[derive(
529 Copy,
530 Clone,
531 Debug,
532 Serialize,
533 Deserialize,
534 JsonSchema,
535 MergeFrom,
536 PartialEq,
537 Eq,
538 strum::VariantArray,
539 strum::VariantNames,
540)]
541#[serde(rename_all = "snake_case")]
542pub enum MultiCursorModifier {
543 Alt,
544 #[serde(alias = "cmd", alias = "ctrl")]
545 CmdOrCtrl,
546}
547
548/// Whether the editor will scroll beyond the last line.
549///
550/// Default: one_page
551#[derive(
552 Copy,
553 Clone,
554 Debug,
555 Serialize,
556 Deserialize,
557 JsonSchema,
558 MergeFrom,
559 PartialEq,
560 Eq,
561 strum::VariantArray,
562 strum::VariantNames,
563)]
564#[serde(rename_all = "snake_case")]
565pub enum ScrollBeyondLastLine {
566 /// The editor will not scroll beyond the last line.
567 Off,
568
569 /// The editor will scroll beyond the last line by one page.
570 OnePage,
571
572 /// The editor will scroll beyond the last line by the same number of lines as vertical_scroll_margin.
573 VerticalScrollMargin,
574}
575
576/// The shape of a selection cursor.
577#[derive(
578 Copy,
579 Clone,
580 Debug,
581 Default,
582 Serialize,
583 Deserialize,
584 PartialEq,
585 Eq,
586 JsonSchema,
587 MergeFrom,
588 strum::VariantArray,
589 strum::VariantNames,
590)]
591#[serde(rename_all = "snake_case")]
592pub enum CursorShape {
593 /// A vertical bar
594 #[default]
595 Bar,
596 /// A block that surrounds the following character
597 Block,
598 /// An underline that runs along the following character
599 Underline,
600 /// A box drawn around the following character
601 Hollow,
602}
603
604/// What to do when go to definition yields no results.
605#[derive(
606 Copy,
607 Clone,
608 Debug,
609 Default,
610 Serialize,
611 Deserialize,
612 PartialEq,
613 Eq,
614 JsonSchema,
615 MergeFrom,
616 strum::VariantArray,
617 strum::VariantNames,
618)]
619#[serde(rename_all = "snake_case")]
620pub enum GoToDefinitionFallback {
621 /// Disables the fallback.
622 None,
623 /// Looks up references of the same symbol instead.
624 #[default]
625 FindAllReferences,
626}
627
628/// Determines when the mouse cursor should be hidden in an editor or input box.
629///
630/// Default: on_typing_and_movement
631#[derive(
632 Copy,
633 Clone,
634 Debug,
635 Default,
636 Serialize,
637 Deserialize,
638 PartialEq,
639 Eq,
640 JsonSchema,
641 MergeFrom,
642 strum::VariantArray,
643 strum::VariantNames,
644)]
645#[serde(rename_all = "snake_case")]
646pub enum HideMouseMode {
647 /// Never hide the mouse cursor
648 Never,
649 /// Hide only when typing
650 OnTyping,
651 /// Hide on both typing and cursor movement
652 #[default]
653 OnTypingAndMovement,
654}
655
656/// Determines how snippets are sorted relative to other completion items.
657///
658/// Default: inline
659#[derive(
660 Copy,
661 Clone,
662 Debug,
663 Default,
664 Serialize,
665 Deserialize,
666 PartialEq,
667 Eq,
668 JsonSchema,
669 MergeFrom,
670 strum::VariantArray,
671 strum::VariantNames,
672)]
673#[serde(rename_all = "snake_case")]
674pub enum SnippetSortOrder {
675 /// Place snippets at the top of the completion list
676 Top,
677 /// Sort snippets normally using the default comparison logic
678 #[default]
679 Inline,
680 /// Place snippets at the bottom of the completion list
681 Bottom,
682 /// Do not show snippets in the completion list
683 None,
684}
685
686/// Default options for buffer and project search items.
687#[skip_serializing_none]
688#[derive(Clone, Default, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq)]
689pub struct SearchSettingsContent {
690 /// Whether to show the project search button in the status bar.
691 pub button: Option<bool>,
692 pub whole_word: Option<bool>,
693 pub case_sensitive: Option<bool>,
694 pub include_ignored: Option<bool>,
695 pub regex: Option<bool>,
696}
697
698#[skip_serializing_none]
699#[derive(Default, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema, MergeFrom)]
700#[serde(rename_all = "snake_case")]
701pub struct JupyterContent {
702 /// Whether the Jupyter feature is enabled.
703 ///
704 /// Default: true
705 pub enabled: Option<bool>,
706
707 /// Default kernels to select for each language.
708 ///
709 /// Default: `{}`
710 pub kernel_selections: Option<HashMap<String, String>>,
711}
712
713/// Whether to allow drag and drop text selection in buffer.
714#[skip_serializing_none]
715#[derive(Clone, Default, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq)]
716pub struct DragAndDropSelectionContent {
717 /// When true, enables drag and drop text selection in buffer.
718 ///
719 /// Default: true
720 pub enabled: Option<bool>,
721
722 /// The delay in milliseconds that must elapse before drag and drop is allowed. Otherwise, a new text selection is created.
723 ///
724 /// Default: 300
725 pub delay: Option<DelayMs>,
726}
727
728/// When to show the minimap in the editor.
729///
730/// Default: never
731#[derive(
732 Copy,
733 Clone,
734 Debug,
735 Default,
736 Serialize,
737 Deserialize,
738 JsonSchema,
739 MergeFrom,
740 PartialEq,
741 Eq,
742 strum::VariantArray,
743 strum::VariantNames,
744)]
745#[serde(rename_all = "snake_case")]
746pub enum ShowMinimap {
747 /// Follow the visibility of the scrollbar.
748 Auto,
749 /// Always show the minimap.
750 Always,
751 /// Never show the minimap.
752 #[default]
753 Never,
754}
755
756/// Where to show the minimap in the editor.
757///
758/// Default: all_editors
759#[derive(
760 Copy,
761 Clone,
762 Debug,
763 Default,
764 Serialize,
765 Deserialize,
766 JsonSchema,
767 MergeFrom,
768 PartialEq,
769 Eq,
770 strum::VariantArray,
771 strum::VariantNames,
772)]
773#[serde(rename_all = "snake_case")]
774pub enum DisplayIn {
775 /// Show on all open editors.
776 AllEditors,
777 /// Show the minimap on the active editor only.
778 #[default]
779 ActiveEditor,
780}
781
782/// Minimum APCA perceptual contrast for text over highlight backgrounds.
783///
784/// Valid range: 0.0 to 106.0
785/// Default: 45.0
786#[derive(
787 Clone,
788 Copy,
789 Debug,
790 Serialize,
791 Deserialize,
792 JsonSchema,
793 MergeFrom,
794 PartialEq,
795 PartialOrd,
796 derive_more::FromStr,
797)]
798#[serde(transparent)]
799pub struct MinimumContrast(pub f32);
800
801impl Display for MinimumContrast {
802 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
803 write!(f, "{:.1}", self.0)
804 }
805}
806
807impl From<f32> for MinimumContrast {
808 fn from(x: f32) -> Self {
809 Self(x)
810 }
811}
812
813/// Opacity of the inactive panes. 0 means transparent, 1 means opaque.
814///
815/// Valid range: 0.0 to 1.0
816/// Default: 1.0
817#[derive(
818 Clone,
819 Copy,
820 Debug,
821 Serialize,
822 Deserialize,
823 JsonSchema,
824 MergeFrom,
825 PartialEq,
826 PartialOrd,
827 derive_more::FromStr,
828)]
829#[serde(transparent)]
830pub struct InactiveOpacity(pub f32);
831
832impl Display for InactiveOpacity {
833 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
834 write!(f, "{:.1}", self.0)
835 }
836}
837
838impl From<f32> for InactiveOpacity {
839 fn from(x: f32) -> Self {
840 Self(x)
841 }
842}