|
1 | 1 | extends TextForgeMode |
2 | 2 |
|
3 | 3 | var keyword_colors: Dictionary[Color, Array] = { |
4 | | - Color(1, 0.45, 0.55, 1): ["def", "class", "lambda", "return", "yield", "try", "except", "finally", "raise"], |
5 | | - Color(1, 0.6, 0.85, 1): ["if", "elif", "else", "for", "while", "break", "continue", "pass", "with", "as", "assert"], |
6 | | - Color(1, 0.7, 0.5, 1): ["import", "from", "global", "nonlocal", "del", "and", "or", "not", "in", "is"], |
7 | | - Color(0.9, 0.8, 0.6, 1): ["True", "False", "None"], |
| 4 | + U.get_syntax_color(U.SyntaxColors.KEYWORD_1): ["def", "class", "lambda", "return", "yield", "try", "except", "finally", "raise"], |
| 5 | + U.get_syntax_color(U.SyntaxColors.KEYWORD_2): ["if", "elif", "else", "for", "while", "break", "continue", "pass", "with", "as", "assert"], |
| 6 | + U.get_syntax_color(U.SyntaxColors.KEYWORD_3): ["import", "from", "global", "nonlocal", "del", "and", "or", "not", "in", "is"], |
| 7 | + U.get_syntax_color(U.SyntaxColors.BUILTIN): ["True", "False", "None"], |
8 | 8 | } |
9 | 9 | var code_regions: Array[Array] = [ |
10 | | - [Color(1, 0.91, 0.64, 1), '"', '"', false], |
11 | | - [Color(1, 0.92, 0.64, 1), "'", "'", false], |
12 | | - [Color(1, 0.92, 0.65, 1), "'''", "'''", false], |
13 | | - [Color(1, 0.91, 0.65, 1), '"""', '"""', false], |
14 | | - [Color(0.8, 0.81, 0.82, 0.5), "#", "", true], |
| 10 | + [U.get_syntax_color(U.SyntaxColors.STRING), '"', '"', false], |
| 11 | + [U.get_syntax_color(U.SyntaxColors.STRING), "'", "'", false], |
| 12 | + [U.get_syntax_color(U.SyntaxColors.STRING), "'''", "'''", false], |
| 13 | + [U.get_syntax_color(U.SyntaxColors.STRING), '"""', '"""', false], |
| 14 | + [U.get_syntax_color(U.SyntaxColors.COMMENT), "#", "", true], |
15 | 15 | ] |
16 | 16 |
|
17 | 17 | func _initialize_mode() -> Error: |
@@ -94,10 +94,10 @@ func _lint_file(text: String) -> Array[Dictionary]: |
94 | 94 |
|
95 | 95 | func _initialize_highlighter() -> void: |
96 | 96 | syntax_highlighter = CodeHighlighter.new() |
97 | | - syntax_highlighter.number_color = Color(0.85, 1, 0.7, 1) |
98 | | - syntax_highlighter.symbol_color = Color(0.7, 0.8, 1, 1) |
99 | | - syntax_highlighter.function_color = Color(0.35, 0.7, 1, 1) |
100 | | - syntax_highlighter.member_variable_color = Color(0.8, 0.85, 1, 1) |
| 97 | + syntax_highlighter.number_color = U.get_syntax_color(U.SyntaxColors.NUMBER) |
| 98 | + syntax_highlighter.symbol_color = U.get_syntax_color(U.SyntaxColors.SYMBOL) |
| 99 | + syntax_highlighter.function_color = U.get_syntax_color(U.SyntaxColors.FUNCTION) |
| 100 | + syntax_highlighter.member_variable_color = U.get_syntax_color(U.SyntaxColors.MEMBER) |
101 | 101 | for color in keyword_colors: |
102 | 102 | for keyword in keyword_colors[color]: |
103 | 103 | syntax_highlighter.add_keyword_color(keyword, color) |
|
0 commit comments