class_colorrect.rst 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the ColorRect.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_ColorRect:
  5. ColorRect
  6. =========
  7. **Inherits:** :ref:`Control<class_control>` **<** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Colored rect for canvas.
  12. Member Functions
  13. ----------------
  14. +----------------------------+-------------------------------------------------------------------------------------------------------+
  15. | :ref:`Color<class_color>` | :ref:`get_frame_color<class_ColorRect_get_frame_color>` **(** **)** const |
  16. +----------------------------+-------------------------------------------------------------------------------------------------------+
  17. | void | :ref:`set_frame_color<class_ColorRect_set_frame_color>` **(** :ref:`Color<class_color>` color **)** |
  18. +----------------------------+-------------------------------------------------------------------------------------------------------+
  19. Member Variables
  20. ----------------
  21. - :ref:`Color<class_color>` **color** - The color to fill the [code]ColorRect[/code].
  22. [codeblock]
  23. $ColorRect.color = Color(1, 0, 0, 1) # Set ColorRect node's color to red
  24. [/codeblock]
  25. Description
  26. -----------
  27. An object that is represented on the canvas as a rect with color. :ref:`Color<class_color>` is used to set or get color info for the rect.
  28. Member Function Description
  29. ---------------------------
  30. .. _class_ColorRect_get_frame_color:
  31. - :ref:`Color<class_color>` **get_frame_color** **(** **)** const
  32. Return the color in RGBA format.
  33. ::
  34. var cr = get_node("colorrect_node")
  35. var c = cr.get_frame_color() # Default color is white
  36. .. _class_ColorRect_set_frame_color:
  37. - void **set_frame_color** **(** :ref:`Color<class_color>` color **)**
  38. Set new color to ColorRect.
  39. ::
  40. var cr = get_node("colorrect_node")
  41. cr.set_frame_color(Color(1, 0, 0, 1)) # Set color rect node to red