-
Notifications
You must be signed in to change notification settings - Fork 2
Syntaxhighlighting
Julius Kirsch edited this page Jan 20, 2023
·
1 revision
There are many predefined syntaxhighlighting languages:
Batch
ConfigFile
C++
C#
GCode
Hex
Html
Javascript
Json
PHP
QSharp
Xml
textbox.CodeLanguage = TextControlBox.GetCodeLanguageFromId("C#");
When you don't want to use syntaxhighlighting you can either disable it completely or set the CodeLanguage to null:
Disable it:
textbox.SyntaxHighlighting = false;
Clear it:
textbox.CodeLanguage = null;
{
"Highlights": [
//highlights with code style formatting
{
"CodeStyle": {
"Bold": true,
"Underlined": true,
"Italic": true
},
"Pattern": "REGEX PATTERN",
"ColorDark": "#ffffff", //color in dark theme
"ColorLight": "#000000" //color in light theme
},
//highlights without code style formatting
{
"Pattern": "REGEX PATTERN",
"ColorDark": "#ffffff", //color in dark theme
"ColorLight": "#000000" //color in light theme
},
],
"Name": "NAME",
"Filter": "EXTENSION1|EXTENSION2", //.cpp|.c
"Description": "DESCRIPTION",
"Author": "AUTHOR"
}
Main file
Code | Meaning |
---|---|
Name | The id of the language |
Filter | The file extensions associated with the language |
Description | A description of the language |
Author | The author of the language |
Highlights | A list containing all the highlights |
Highlight
Code | Meaning |
---|---|
Pattern | The Regex pattern matching the text to highlight |
ColorDark | The color of the matching pattern in dark mode |
ColorLight | The color of the matching pattern in light mode |
CodeStyle | The formatting of the matching pattern (Bold/Italic/Underlined) |
CodeStyle
Code | Meaning |
---|---|
Bold | The matching pattern in bold |
Italic | The matching pattern in italic |
Underlined | The matching pattern in underlined |
//Use a custom language:
var result = TextControlBox.GetCodeLanguageFromJson("JSON DATA"); //read the data from your file and pass it to the function
if(result.Succeed)
textbox.CodeLanguage = result.CodeLanguage;