class_colorrect.rst 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the ColorRect.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_ColorRect:
  6. ColorRect
  7. =========
  8. **Inherits:** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. Colored rectangle.
  10. Description
  11. -----------
  12. Displays a rectangle filled with a solid :ref:`color<class_ColorRect_property_color>`. If you need to display the border alone, consider using :ref:`ReferenceRect<class_ReferenceRect>` instead.
  13. Tutorials
  14. ---------
  15. - `2D Dodge The Creeps Demo <https://godotengine.org/asset-library/asset/515>`__
  16. Properties
  17. ----------
  18. +---------------------------+----------------------------------------------+-----------------------+
  19. | :ref:`Color<class_Color>` | :ref:`color<class_ColorRect_property_color>` | ``Color(1, 1, 1, 1)`` |
  20. +---------------------------+----------------------------------------------+-----------------------+
  21. Property Descriptions
  22. ---------------------
  23. .. _class_ColorRect_property_color:
  24. - :ref:`Color<class_Color>` **color**
  25. +-----------+-----------------------+
  26. | *Default* | ``Color(1, 1, 1, 1)`` |
  27. +-----------+-----------------------+
  28. | *Setter* | set_color(value) |
  29. +-----------+-----------------------+
  30. | *Getter* | get_color() |
  31. +-----------+-----------------------+
  32. The fill color.
  33. .. tabs::
  34. .. code-tab:: gdscript
  35. $ColorRect.color = Color(1, 0, 0, 1) # Set ColorRect's color to red.
  36. .. code-tab:: csharp
  37. GetNode<ColorRect>("ColorRect").Color = new Color(1, 0, 0, 1); // Set ColorRect's color to red.
  38. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  39. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  40. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  41. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  42. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  43. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`