update syntax highlighting to use vscode dark mode theme
This commit is contained in:
@@ -118,18 +118,31 @@ public static unsafe class SlangExtensions
|
||||
{
|
||||
switch (kind)
|
||||
{
|
||||
case 1:
|
||||
return SlangFormatter.ColorString; // String
|
||||
case 2:
|
||||
return SlangFormatter.ColorString; // Number
|
||||
case 3:
|
||||
return SlangFormatter.ColorInstruction; // Boolean
|
||||
case 4:
|
||||
return SlangFormatter.ColorSelection; // Keyword
|
||||
case 5:
|
||||
return SlangFormatter.ColorLineNumber; // Identifier
|
||||
case 6:
|
||||
return SlangFormatter.ColorDefault; // Symbol
|
||||
case 1: // Strings
|
||||
return SlangFormatter.ColorString;
|
||||
case 2: // Numbers
|
||||
return SlangFormatter.ColorNumber;
|
||||
case 3: // Booleans
|
||||
return SlangFormatter.ColorBoolean;
|
||||
|
||||
case 4: // (if, else, loop)
|
||||
return SlangFormatter.ColorControl;
|
||||
case 5: // (let, const, device)
|
||||
return SlangFormatter.ColorDeclaration;
|
||||
|
||||
case 6: // (variables)
|
||||
return SlangFormatter.ColorIdentifier;
|
||||
case 7: // (punctuation)
|
||||
return SlangFormatter.ColorDefault;
|
||||
|
||||
case 10: // (syscalls)
|
||||
return SlangFormatter.ColorFunction;
|
||||
|
||||
case 11: // Comparisons
|
||||
case 12: // Math
|
||||
case 13: // Logic
|
||||
return SlangFormatter.ColorOperator;
|
||||
|
||||
default:
|
||||
return SlangFormatter.ColorDefault;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,19 @@ public class SlangFormatter : ICodeFormatter
|
||||
private CancellationTokenSource? _lspCancellationToken;
|
||||
private object _tokenLock = new();
|
||||
|
||||
public static readonly uint ColorInstruction = ColorFromHTML("#ffff00");
|
||||
public static readonly uint ColorString = ColorFromHTML("#ce9178");
|
||||
// VS Code Dark Theme Palette
|
||||
public static readonly uint ColorControl = ColorFromHTML("#C586C0"); // Pink (if, return, loop)
|
||||
public static readonly uint ColorDeclaration = ColorFromHTML("#569CD6"); // Blue (let, device, fn)
|
||||
public static readonly uint ColorFunction = ColorFromHTML("#DCDCAA"); // Yellow (syscalls)
|
||||
public static readonly uint ColorString = ColorFromHTML("#CE9178"); // Orange
|
||||
public static new readonly uint ColorNumber = ColorFromHTML("#B5CEA8"); // Light Green
|
||||
public static readonly uint ColorBoolean = ColorFromHTML("#569CD6"); // Blue (true/false)
|
||||
public static readonly uint ColorIdentifier = ColorFromHTML("#9CDCFE"); // Light Blue (variables)
|
||||
public static new readonly uint ColorDefault = ColorFromHTML("#D4D4D4"); // White (punctuation ; { } )
|
||||
|
||||
// Operators are often the same color as default text in VS Code Dark,
|
||||
// but having a separate definition lets you tweak it (e.g. make them slightly darker or distinct)
|
||||
public static readonly uint ColorOperator = ColorFromHTML("#D4D4D4");
|
||||
|
||||
private HashSet<uint> _linesWithErrors = new();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user