|
1 | 1 | package consulo.python.impl; |
2 | 2 |
|
| 3 | +import com.jetbrains.python.impl.highlighting.PyHighlighter; |
3 | 4 | import consulo.annotation.component.ExtensionImpl; |
4 | | -import consulo.colorScheme.AdditionalTextAttributesProvider; |
| 5 | +import consulo.colorScheme.AttributesFlyweightBuilder; |
| 6 | +import consulo.colorScheme.EditorColorSchemeExtender; |
5 | 7 | import consulo.colorScheme.EditorColorsScheme; |
| 8 | +import consulo.colorScheme.EffectType; |
| 9 | +import consulo.ui.color.RGBColor; |
6 | 10 | import jakarta.annotation.Nonnull; |
7 | 11 |
|
8 | 12 | /** |
9 | 13 | * @author VISTALL |
10 | 14 | * @since 21/06/2023 |
11 | 15 | */ |
12 | 16 | @ExtensionImpl |
13 | | -public class PythonDarkAdditionalTextAttributesProvider implements AdditionalTextAttributesProvider { |
14 | | - @Nonnull |
15 | | - @Override |
16 | | - public String getColorSchemeName() { |
17 | | - return EditorColorsScheme.DARCULA_SCHEME_NAME; |
18 | | - } |
19 | | - |
20 | | - @Nonnull |
21 | | - @Override |
22 | | - public String getColorSchemeFile() { |
23 | | - return "/colorSchemes/PythonDarcula.xml"; |
24 | | - } |
| 17 | +public class PythonDarkAdditionalTextAttributesProvider implements EditorColorSchemeExtender { |
| 18 | + @Nonnull |
| 19 | + @Override |
| 20 | + public String getColorSchemeId() { |
| 21 | + return EditorColorsScheme.DEFAULT_SCHEME_NAME; |
| 22 | + } |
| 23 | + |
| 24 | + @Override |
| 25 | + public void extend(Builder builder) { |
| 26 | + builder.add(PyHighlighter.PY_BUILTIN_NAME, AttributesFlyweightBuilder.create() |
| 27 | + .withForeground(new RGBColor(0x80, 0x00, 0x0)) |
| 28 | + .build()); |
| 29 | + |
| 30 | + builder.add(PyHighlighter.PY_CLASS_DEFINITION, AttributesFlyweightBuilder.create() |
| 31 | + .withBoldFont() |
| 32 | + .withEffect(EffectType.WAVE_UNDERSCORE, null) |
| 33 | + .build()); |
| 34 | + |
| 35 | + builder.add(PyHighlighter.PY_DECORATOR, AttributesFlyweightBuilder.create() |
| 36 | + .withForeground(new RGBColor(0xbb, 0xb5, 0x29)) |
| 37 | + .withEffect(EffectType.WAVE_UNDERSCORE, null) |
| 38 | + .build()); |
| 39 | + |
| 40 | + builder.add(PyHighlighter.PY_FUNC_DEFINITION, AttributesFlyweightBuilder.create() |
| 41 | + .withBoldFont() |
| 42 | + .withEffect(EffectType.WAVE_UNDERSCORE, null) |
| 43 | + .build()); |
| 44 | + |
| 45 | + builder.add(PyHighlighter.PY_KEYWORD_ARGUMENT, AttributesFlyweightBuilder.create() |
| 46 | + .withForeground(new RGBColor(0xaa, 0x49, 0x26)) |
| 47 | + .build()); |
| 48 | + |
| 49 | + builder.add(PyHighlighter.PY_PREDEFINED_DEFINITION, AttributesFlyweightBuilder.create() |
| 50 | + .withForeground(new RGBColor(0xB2, 0x00, 0xB2)) |
| 51 | + .build()); |
| 52 | + |
| 53 | + builder.add(PyHighlighter.PY_PREDEFINED_USAGE, AttributesFlyweightBuilder.create() |
| 54 | + .withForeground(new RGBColor(0xB2, 0x00, 0xB2)) |
| 55 | + .build()); |
| 56 | + |
| 57 | + builder.add(PyHighlighter.PY_SELF_PARAMETER, AttributesFlyweightBuilder.create() |
| 58 | + .withForeground(new RGBColor(0x94, 0x55, 0x8D)) |
| 59 | + .build()); |
| 60 | + |
| 61 | + builder.add(PyHighlighter.PY_BYTE_STRING, AttributesFlyweightBuilder.create() |
| 62 | + .withForeground(new RGBColor(0xa5, 0xc2, 0x61)) |
| 63 | + .withBoldFont() |
| 64 | + .build()); |
| 65 | + |
| 66 | + builder.add(PyHighlighter.PY_UNICODE_STRING, AttributesFlyweightBuilder.create() |
| 67 | + .withForeground(new RGBColor(0x00, 0x80, 0x80)) |
| 68 | + .withBoldFont() |
| 69 | + .build()); |
| 70 | + } |
25 | 71 | } |
0 commit comments