Class CodeHighlighter
A syntax highlighter intended for code.
- Inheritance
-
CodeHighlighter
Remarks
By adjusting various properties of this resource, you can change the colors of strings, comments, numbers, and other text patterns inside a TextEdit control.
Properties
color_regions
Sets the color regions. All existing regions will be removed. The Dictionary key is the region start and end key, separated by a space. The value is the region color.
var color_regions : Dictionary = {}
Property Value
Remarks
- void set_color_regions(Dictionary value)
- Dictionary get_color_regions
function_color
Sets color for functions. A function is a non-keyword string followed by a '('.
var function_color : Color = Color(0, 0, 0, 1)
Property Value
Remarks
keyword_colors
Sets the keyword colors. All existing keywords will be removed. The Dictionary key is the keyword. The value is the keyword color.
var keyword_colors : Dictionary = {}
Property Value
Remarks
- void set_keyword_colors(Dictionary value)
- Dictionary get_keyword_colors
member_keyword_colors
Sets the member keyword colors. All existing member keyword will be removed. The Dictionary key is the member keyword. The value is the member keyword color.
var member_keyword_colors : Dictionary = {}
Property Value
Remarks
- void set_member_keyword_colors(Dictionary value)
- Dictionary get_member_keyword_colors
member_variable_color
Sets color for member variables. A member variable is non-keyword, non-function string proceeded with a '.'.
var member_variable_color : Color = Color(0, 0, 0, 1)
Property Value
Remarks
number_color
Sets the color for numbers.
var number_color : Color = Color(0, 0, 0, 1)
Property Value
Remarks
symbol_color
Sets the color for symbols.
var symbol_color : Color = Color(0, 0, 0, 1)
Property Value
Remarks
Methods
add_color_region(String, String, Color, bool)
Adds a color region (such as for comments or strings) from start_key to end_key. Both keys should be symbols, and start_key must not be shared with other delimiters.
If line_only is true or end_key is an empty String, the region does not carry over to the next line.
void add_color_region(String start_key, String end_key, Color color, bool line_only)
Parameters
add_keyword_color(String, Color)
Sets the color for a keyword.
The keyword cannot contain any symbols except '_'.
void add_keyword_color(String keyword, Color color)
Parameters
add_member_keyword_color(String, Color)
Sets the color for a member keyword.
The member keyword cannot contain any symbols except '_'.
It will not be highlighted if preceded by a '.'.
void add_member_keyword_color(String member_keyword, Color color)
Parameters
clear_color_regions
Removes all color regions.
void clear_color_regions
clear_keyword_colors
Removes all keywords.
void clear_keyword_colors
clear_member_keyword_colors
Removes all member keywords.
void clear_member_keyword_colors
get_keyword_color(String)
Qualifiers: const
Returns the color for a keyword.
Color get_keyword_color(String keyword)
Parameters
keywordString
get_member_keyword_color(String)
Qualifiers: const
Returns the color for a member keyword.
Color get_member_keyword_color(String member_keyword)
Parameters
member_keywordString
has_color_region(String)
Qualifiers: const
Returns true if the start key exists, else false.
bool has_color_region(String start_key)
Parameters
start_keyString
has_keyword_color(String)
Qualifiers: const
Returns true if the keyword exists, else false.
bool has_keyword_color(String keyword)
Parameters
keywordString
has_member_keyword_color(String)
Qualifiers: const
Returns true if the member keyword exists, else false.
bool has_member_keyword_color(String member_keyword)
Parameters
member_keywordString
remove_color_region(String)
Removes the color region that uses that start key.
void remove_color_region(String start_key)
Parameters
start_keyString
remove_keyword_color(String)
Removes the keyword.
void remove_keyword_color(String keyword)
Parameters
keywordString
remove_member_keyword_color(String)
Removes the member keyword.
void remove_member_keyword_color(String member_keyword)
Parameters
member_keywordString