mirror of
https://github.com/BlossomiShymae/Needlework.Net.git
synced 2025-12-06 18:20:47 +01:00
WIP
This commit is contained in:
29
Needlework.Net.Desktop/Extensions/TextEditorExtensions.cs
Normal file
29
Needlework.Net.Desktop/Extensions/TextEditorExtensions.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Avalonia.Media;
|
||||
using AvaloniaEdit;
|
||||
using AvaloniaEdit.Highlighting;
|
||||
using AvaloniaEdit.Indentation.CSharp;
|
||||
|
||||
namespace Needlework.Net.Desktop.Extensions
|
||||
{
|
||||
public static class TextEditorExtensions
|
||||
{
|
||||
public static void ApplyJsonEditorSettings(this TextEditor textEditor)
|
||||
{
|
||||
textEditor.TextArea.IndentationStrategy = new CSharpIndentationStrategy(textEditor.Options);
|
||||
textEditor.TextArea.RightClickMovesCaret = true;
|
||||
textEditor.TextArea.Options.EnableHyperlinks = false;
|
||||
textEditor.TextArea.Options.EnableEmailHyperlinks = false;
|
||||
textEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("Json");
|
||||
|
||||
var purple = Color.FromRgb(189, 147, 249);
|
||||
var yellow = Color.FromRgb(241, 250, 140);
|
||||
var cyan = Color.FromRgb(139, 233, 253);
|
||||
textEditor.SyntaxHighlighting.GetNamedColor("Bool").Foreground = new SimpleHighlightingBrush(purple);
|
||||
textEditor.SyntaxHighlighting.GetNamedColor("Number").Foreground = new SimpleHighlightingBrush(purple);
|
||||
textEditor.SyntaxHighlighting.GetNamedColor("String").Foreground = new SimpleHighlightingBrush(yellow);
|
||||
textEditor.SyntaxHighlighting.GetNamedColor("Null").Foreground = new SimpleHighlightingBrush(purple);
|
||||
textEditor.SyntaxHighlighting.GetNamedColor("FieldName").Foreground = new SimpleHighlightingBrush(cyan);
|
||||
textEditor.SyntaxHighlighting.GetNamedColor("Punctuation").Foreground = new SimpleHighlightingBrush(yellow);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user