123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400 |
- :github_url: hide
- .. DO NOT EDIT THIS FILE!!!
- .. Generated automatically from Godot engine sources.
- .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
- .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/CodeHighlighter.xml.
- .. _class_CodeHighlighter:
- CodeHighlighter
- ===============
- **Inherits:** :ref:`SyntaxHighlighter<class_SyntaxHighlighter>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
- A syntax highlighter intended for code.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- By adjusting various properties of this resource, you can change the colors of strings, comments, numbers, and other text patterns inside a :ref:`TextEdit<class_TextEdit>` control.
- .. rst-class:: classref-reftable-group
- Properties
- ----------
- .. table::
- :widths: auto
- +-------------------------------------+------------------------------------------------------------------------------------+-----------------------+
- | :ref:`Dictionary<class_Dictionary>` | :ref:`color_regions<class_CodeHighlighter_property_color_regions>` | ``{}`` |
- +-------------------------------------+------------------------------------------------------------------------------------+-----------------------+
- | :ref:`Color<class_Color>` | :ref:`function_color<class_CodeHighlighter_property_function_color>` | ``Color(0, 0, 0, 1)`` |
- +-------------------------------------+------------------------------------------------------------------------------------+-----------------------+
- | :ref:`Dictionary<class_Dictionary>` | :ref:`keyword_colors<class_CodeHighlighter_property_keyword_colors>` | ``{}`` |
- +-------------------------------------+------------------------------------------------------------------------------------+-----------------------+
- | :ref:`Dictionary<class_Dictionary>` | :ref:`member_keyword_colors<class_CodeHighlighter_property_member_keyword_colors>` | ``{}`` |
- +-------------------------------------+------------------------------------------------------------------------------------+-----------------------+
- | :ref:`Color<class_Color>` | :ref:`member_variable_color<class_CodeHighlighter_property_member_variable_color>` | ``Color(0, 0, 0, 1)`` |
- +-------------------------------------+------------------------------------------------------------------------------------+-----------------------+
- | :ref:`Color<class_Color>` | :ref:`number_color<class_CodeHighlighter_property_number_color>` | ``Color(0, 0, 0, 1)`` |
- +-------------------------------------+------------------------------------------------------------------------------------+-----------------------+
- | :ref:`Color<class_Color>` | :ref:`symbol_color<class_CodeHighlighter_property_symbol_color>` | ``Color(0, 0, 0, 1)`` |
- +-------------------------------------+------------------------------------------------------------------------------------+-----------------------+
- .. rst-class:: classref-reftable-group
- Methods
- -------
- .. table::
- :widths: auto
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`add_color_region<class_CodeHighlighter_method_add_color_region>` **(** :ref:`String<class_String>` start_key, :ref:`String<class_String>` end_key, :ref:`Color<class_Color>` color, :ref:`bool<class_bool>` line_only=false **)** |
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`add_keyword_color<class_CodeHighlighter_method_add_keyword_color>` **(** :ref:`String<class_String>` keyword, :ref:`Color<class_Color>` color **)** |
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`add_member_keyword_color<class_CodeHighlighter_method_add_member_keyword_color>` **(** :ref:`String<class_String>` member_keyword, :ref:`Color<class_Color>` color **)** |
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`clear_color_regions<class_CodeHighlighter_method_clear_color_regions>` **(** **)** |
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`clear_keyword_colors<class_CodeHighlighter_method_clear_keyword_colors>` **(** **)** |
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`clear_member_keyword_colors<class_CodeHighlighter_method_clear_member_keyword_colors>` **(** **)** |
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Color<class_Color>` | :ref:`get_keyword_color<class_CodeHighlighter_method_get_keyword_color>` **(** :ref:`String<class_String>` keyword **)** |const| |
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Color<class_Color>` | :ref:`get_member_keyword_color<class_CodeHighlighter_method_get_member_keyword_color>` **(** :ref:`String<class_String>` member_keyword **)** |const| |
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`has_color_region<class_CodeHighlighter_method_has_color_region>` **(** :ref:`String<class_String>` start_key **)** |const| |
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`has_keyword_color<class_CodeHighlighter_method_has_keyword_color>` **(** :ref:`String<class_String>` keyword **)** |const| |
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`has_member_keyword_color<class_CodeHighlighter_method_has_member_keyword_color>` **(** :ref:`String<class_String>` member_keyword **)** |const| |
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`remove_color_region<class_CodeHighlighter_method_remove_color_region>` **(** :ref:`String<class_String>` start_key **)** |
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`remove_keyword_color<class_CodeHighlighter_method_remove_keyword_color>` **(** :ref:`String<class_String>` keyword **)** |
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`remove_member_keyword_color<class_CodeHighlighter_method_remove_member_keyword_color>` **(** :ref:`String<class_String>` member_keyword **)** |
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Property Descriptions
- ---------------------
- .. _class_CodeHighlighter_property_color_regions:
- .. rst-class:: classref-property
- :ref:`Dictionary<class_Dictionary>` **color_regions** = ``{}``
- .. rst-class:: classref-property-setget
- - void **set_color_regions** **(** :ref:`Dictionary<class_Dictionary>` value **)**
- - :ref:`Dictionary<class_Dictionary>` **get_color_regions** **(** **)**
- Sets the color regions. All existing regions will be removed. The :ref:`Dictionary<class_Dictionary>` key is the region start and end key, separated by a space. The value is the region color.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CodeHighlighter_property_function_color:
- .. rst-class:: classref-property
- :ref:`Color<class_Color>` **function_color** = ``Color(0, 0, 0, 1)``
- .. rst-class:: classref-property-setget
- - void **set_function_color** **(** :ref:`Color<class_Color>` value **)**
- - :ref:`Color<class_Color>` **get_function_color** **(** **)**
- Sets color for functions. A function is a non-keyword string followed by a '('.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CodeHighlighter_property_keyword_colors:
- .. rst-class:: classref-property
- :ref:`Dictionary<class_Dictionary>` **keyword_colors** = ``{}``
- .. rst-class:: classref-property-setget
- - void **set_keyword_colors** **(** :ref:`Dictionary<class_Dictionary>` value **)**
- - :ref:`Dictionary<class_Dictionary>` **get_keyword_colors** **(** **)**
- Sets the keyword colors. All existing keywords will be removed. The :ref:`Dictionary<class_Dictionary>` key is the keyword. The value is the keyword color.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CodeHighlighter_property_member_keyword_colors:
- .. rst-class:: classref-property
- :ref:`Dictionary<class_Dictionary>` **member_keyword_colors** = ``{}``
- .. rst-class:: classref-property-setget
- - void **set_member_keyword_colors** **(** :ref:`Dictionary<class_Dictionary>` value **)**
- - :ref:`Dictionary<class_Dictionary>` **get_member_keyword_colors** **(** **)**
- Sets the member keyword colors. All existing member keyword will be removed. The :ref:`Dictionary<class_Dictionary>` key is the member keyword. The value is the member keyword color.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CodeHighlighter_property_member_variable_color:
- .. rst-class:: classref-property
- :ref:`Color<class_Color>` **member_variable_color** = ``Color(0, 0, 0, 1)``
- .. rst-class:: classref-property-setget
- - void **set_member_variable_color** **(** :ref:`Color<class_Color>` value **)**
- - :ref:`Color<class_Color>` **get_member_variable_color** **(** **)**
- Sets color for member variables. A member variable is non-keyword, non-function string proceeded with a '.'.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CodeHighlighter_property_number_color:
- .. rst-class:: classref-property
- :ref:`Color<class_Color>` **number_color** = ``Color(0, 0, 0, 1)``
- .. rst-class:: classref-property-setget
- - void **set_number_color** **(** :ref:`Color<class_Color>` value **)**
- - :ref:`Color<class_Color>` **get_number_color** **(** **)**
- Sets the color for numbers.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CodeHighlighter_property_symbol_color:
- .. rst-class:: classref-property
- :ref:`Color<class_Color>` **symbol_color** = ``Color(0, 0, 0, 1)``
- .. rst-class:: classref-property-setget
- - void **set_symbol_color** **(** :ref:`Color<class_Color>` value **)**
- - :ref:`Color<class_Color>` **get_symbol_color** **(** **)**
- Sets the color for symbols.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Method Descriptions
- -------------------
- .. _class_CodeHighlighter_method_add_color_region:
- .. rst-class:: classref-method
- void **add_color_region** **(** :ref:`String<class_String>` start_key, :ref:`String<class_String>` end_key, :ref:`Color<class_Color>` color, :ref:`bool<class_bool>` line_only=false **)**
- Adds a color region such as comments or strings.
- Both the start and end keys must be symbols. Only the start key has to be unique.
- \ ``line_only`` denotes if the region should continue until the end of the line or carry over on to the next line. If the end key is blank this is automatically set to ``true``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CodeHighlighter_method_add_keyword_color:
- .. rst-class:: classref-method
- void **add_keyword_color** **(** :ref:`String<class_String>` keyword, :ref:`Color<class_Color>` color **)**
- Sets the color for a keyword.
- The keyword cannot contain any symbols except '\_'.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CodeHighlighter_method_add_member_keyword_color:
- .. rst-class:: classref-method
- void **add_member_keyword_color** **(** :ref:`String<class_String>` member_keyword, :ref:`Color<class_Color>` 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 '.'.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CodeHighlighter_method_clear_color_regions:
- .. rst-class:: classref-method
- void **clear_color_regions** **(** **)**
- Removes all color regions.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CodeHighlighter_method_clear_keyword_colors:
- .. rst-class:: classref-method
- void **clear_keyword_colors** **(** **)**
- Removes all keywords.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CodeHighlighter_method_clear_member_keyword_colors:
- .. rst-class:: classref-method
- void **clear_member_keyword_colors** **(** **)**
- Removes all member keywords.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CodeHighlighter_method_get_keyword_color:
- .. rst-class:: classref-method
- :ref:`Color<class_Color>` **get_keyword_color** **(** :ref:`String<class_String>` keyword **)** |const|
- Returns the color for a keyword.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CodeHighlighter_method_get_member_keyword_color:
- .. rst-class:: classref-method
- :ref:`Color<class_Color>` **get_member_keyword_color** **(** :ref:`String<class_String>` member_keyword **)** |const|
- Returns the color for a member keyword.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CodeHighlighter_method_has_color_region:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **has_color_region** **(** :ref:`String<class_String>` start_key **)** |const|
- Returns ``true`` if the start key exists, else ``false``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CodeHighlighter_method_has_keyword_color:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **has_keyword_color** **(** :ref:`String<class_String>` keyword **)** |const|
- Returns ``true`` if the keyword exists, else ``false``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CodeHighlighter_method_has_member_keyword_color:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **has_member_keyword_color** **(** :ref:`String<class_String>` member_keyword **)** |const|
- Returns ``true`` if the member keyword exists, else ``false``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CodeHighlighter_method_remove_color_region:
- .. rst-class:: classref-method
- void **remove_color_region** **(** :ref:`String<class_String>` start_key **)**
- Removes the color region that uses that start key.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CodeHighlighter_method_remove_keyword_color:
- .. rst-class:: classref-method
- void **remove_keyword_color** **(** :ref:`String<class_String>` keyword **)**
- Removes the keyword.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CodeHighlighter_method_remove_member_keyword_color:
- .. rst-class:: classref-method
- void **remove_member_keyword_color** **(** :ref:`String<class_String>` member_keyword **)**
- Removes the member keyword.
- .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
- .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
- .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
- .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
- .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
- .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
- .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
|