|
1 | 1 | extends TextForgeMode |
2 | 2 |
|
3 | 3 | var keyword_colors: Dictionary[Color, Array] = { |
4 | | - Color.hex(0xe68c8cff): [ "inherit", "initial", "unset", "revert" ], |
5 | | - Color.hex(0xcca6ffff): [ "auto", "block", "inline", "flex", "grid", "none" ], |
6 | | - Color.hex(0x99ccffff): [ "transparent", "currentColor" ], |
7 | | - Color.hex(0xffcc99ff): [ "px", "em", "rem", "%", "vh", "vw", "vmin", "vmax", "ch", "ex", "cm", "mm", "in", "pt", "pc" ], |
8 | | - Color.hex(0xccffccff): [ "left", "right", "top", "bottom", "center", "start", "end" ], |
9 | | - Color.hex(0xff99ccff): [ "repeat", "no-repeat", "repeat-x", "repeat-y", "space", "round", "cover", "contain" ], |
10 | | - Color.hex(0xb3b3ffff): [ "bold", "normal", "italic", "oblique", "small-caps", "uppercase", "lowercase", "capitalize" ], |
11 | | - Color.hex(0xffccffff): [ "ease", "linear", "ease-in", "ease-out", "ease-in-out", "infinite", "forwards", "backwards", "alternate" ], |
12 | | - Color.hex(0xd9b3ffff): [ "rotate", "scale", "skew", "translate", "rotateX", "rotateY", "translateX", "translateY" ], |
13 | | - Color.hex(0xb3ffd9ff): [ "filter", "hue-rotate", "blur", "brightness", "contrast", "drop-shadow", "grayscale", "invert", "opacity", "saturate", "sepia" ], |
14 | | - Color.hex(0xffe6ccff): [ "margin", "padding", "width", "height", "border", "border-radius", "box-shadow", "font-family", "background", "background-color", "transition", "animation", "animation-name", "animation-duration", "animation-iteration-count", "animation-direction", "animation-timing-function", "keyframes" ] |
| 4 | + U.get_syntax_color(U.SyntaxColors.BUILTIN): [ "word", "letter", "line", "spacing", "size", "text", "font", "family", "border", "radius", "box", "shadow", "margin", "padding", "width", "height", "border", "background", "color", "transition", "animation", "name", "duration", "iteration", "count", "direction", "timing", "function", "keyframes" ], |
| 5 | + U.get_syntax_color(U.SyntaxColors.KEYWORD_1): [ "inherit", "initial", "unset", "revert" ], |
| 6 | + U.get_syntax_color(U.SyntaxColors.KEYWORD_2): [ "repeat", "no-repeat", "repeat", "x", "y", "space", "round", "cover", "contain", "auto", "block", "inline", "flex", "grid", "none" ], |
| 7 | + U.get_syntax_color(U.SyntaxColors.KEYWORD_3): [ "px", "em", "rem", "%", "vh", "vw", "vmin", "vmax", "ch", "ex", "cm", "mm", "in", "pt", "pc" ], |
| 8 | + U.get_syntax_color(U.SyntaxColors.CUSTOM_2): [ "bold", "normal", "italic", "oblique", "small-caps", "uppercase", "lowercase", "capitalize" ], |
| 9 | + U.get_syntax_color(U.SyntaxColors.CUSTOM_3): [ "rotate", "scale", "skew", "translate", "rotateX", "rotateY", "translateX", "translateY" ], |
| 10 | + U.get_syntax_color(U.SyntaxColors.CUSTOM_5): [ "transparent", "currentColor" ], |
| 11 | + U.get_syntax_color(U.SyntaxColors.TYPE_1): [ "filter", "hue-rotate", "blur", "brightness", "contrast", "drop", "shadow", "grayscale", "invert", "opacity", "saturate", "sepia" ], |
| 12 | + U.get_syntax_color(U.SyntaxColors.TYPE_2): [ "ease", "linear", "in", "out", "infinite", "forwards", "backwards", "alternate" ], |
| 13 | + U.get_syntax_color(U.SyntaxColors.TYPE_3): [ "left", "right", "top", "bottom", "center", "start", "end" ], |
15 | 14 | } |
16 | 15 | var code_regions: Array[Array] = [ |
17 | | - [Color.hex(0xf2f2ccff), '"', '"', false], |
18 | | - [Color.hex(0xf2f2ccff), "'", "'", false], |
19 | | - [Color.hex(0xb3fff2ff), "/*", "*/", false], |
| 16 | + [U.get_syntax_color(U.SyntaxColors.STRING), '"', '"', false], |
| 17 | + [U.get_syntax_color(U.SyntaxColors.STRING), "'", "'", false], |
| 18 | + [U.get_syntax_color(U.SyntaxColors.COMMENT), "/*", "*/", false], |
20 | 19 | ] |
21 | 20 |
|
22 | 21 | func _initialize_mode() -> Error: |
@@ -80,10 +79,10 @@ func _lint_file(text: String) -> Array[Dictionary]: |
80 | 79 |
|
81 | 80 | func _initialize_highlighter() -> void: |
82 | 81 | syntax_highlighter = CodeHighlighter.new() |
83 | | - syntax_highlighter.number_color = Color.hex(0xe6b380ff) |
84 | | - syntax_highlighter.symbol_color = Color.hex(0x80ccffff) |
85 | | - syntax_highlighter.function_color = Color.hex(0xffcc80ff) |
86 | | - syntax_highlighter.member_variable_color = Color.hex(0xb3ffd9ff) |
| 82 | + syntax_highlighter.number_color = U.get_syntax_color(U.SyntaxColors.NUMBER) |
| 83 | + syntax_highlighter.symbol_color = U.get_syntax_color(U.SyntaxColors.SYMBOL) |
| 84 | + syntax_highlighter.function_color = U.get_syntax_color(U.SyntaxColors.FUNCTION) |
| 85 | + syntax_highlighter.member_variable_color = U.get_syntax_color(U.SyntaxColors.MEMBER) |
87 | 86 | for color in keyword_colors: |
88 | 87 | for keyword in keyword_colors[color]: |
89 | 88 | syntax_highlighter.add_keyword_color(keyword, color) |
|
0 commit comments