class_color.rst 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_Color:
  4. Color
  5. =====
  6. **Category:** Built-In Types
  7. Brief Description
  8. -----------------
  9. Color in RGBA format.
  10. Member Functions
  11. ----------------
  12. +------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  13. | :ref:`Color<class_color>` | :ref:`Color<class_Color_Color>` **(** :ref:`float<class_float>` r, :ref:`float<class_float>` g, :ref:`float<class_float>` b, :ref:`float<class_float>` a **)** |
  14. +------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | :ref:`Color<class_color>` | :ref:`Color<class_Color_Color>` **(** :ref:`float<class_float>` r, :ref:`float<class_float>` g, :ref:`float<class_float>` b **)** |
  16. +------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`Color<class_color>` | :ref:`Color<class_Color_Color>` **(** :ref:`int<class_int>` from **)** |
  18. +------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`Color<class_color>` | :ref:`Color<class_Color_Color>` **(** :ref:`String<class_string>` from **)** |
  20. +------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`Color<class_color>` | :ref:`blend<class_Color_blend>` **(** :ref:`Color<class_color>` over **)** |
  22. +------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`Color<class_color>` | :ref:`contrasted<class_Color_contrasted>` **(** **)** |
  24. +------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`float<class_float>` | :ref:`gray<class_Color_gray>` **(** **)** |
  26. +------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`Color<class_color>` | :ref:`inverted<class_Color_inverted>` **(** **)** |
  28. +------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`Color<class_color>` | :ref:`linear_interpolate<class_Color_linear_interpolate>` **(** :ref:`Color<class_color>` b, :ref:`float<class_float>` t **)** |
  30. +------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`int<class_int>` | :ref:`to_32<class_Color_to_32>` **(** **)** |
  32. +------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`int<class_int>` | :ref:`to_ARGB32<class_Color_to_ARGB32>` **(** **)** |
  34. +------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`String<class_string>` | :ref:`to_html<class_Color_to_html>` **(** :ref:`bool<class_bool>` with_alpha=True **)** |
  36. +------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. Member Variables
  38. ----------------
  39. - :ref:`float<class_float>` **a** - Alpha (0 to 1)
  40. - :ref:`int<class_int>` **a8** - Alpha (0 to 255)
  41. - :ref:`float<class_float>` **b** - Blue (0 to 1)
  42. - :ref:`int<class_int>` **b8** - Blue (0 to 255)
  43. - :ref:`float<class_float>` **g** - Green (0 to 1)
  44. - :ref:`int<class_int>` **g8** - Green (0 to 255)
  45. - :ref:`float<class_float>` **h** - Hue (0 to 1)
  46. - :ref:`float<class_float>` **r** - Red (0 to 1)
  47. - :ref:`int<class_int>` **r8** - Red (0 to 255)
  48. - :ref:`float<class_float>` **s** - Saturation (0 to 1)
  49. - :ref:`float<class_float>` **v** - Value (0 to 1)
  50. Description
  51. -----------
  52. A color is represented as red, green and blue (r,g,b) components. Additionally, "a" represents the alpha component, often used for transparency. Values are in floating point and usually range from 0 to 1. Some methods (such as set_modulate() ) may accept values > 1.
  53. Member Function Description
  54. ---------------------------
  55. .. _class_Color_Color:
  56. - :ref:`Color<class_color>` **Color** **(** :ref:`float<class_float>` r, :ref:`float<class_float>` g, :ref:`float<class_float>` b, :ref:`float<class_float>` a **)**
  57. Construct the color from an RGBA profile.
  58. .. _class_Color_Color:
  59. - :ref:`Color<class_color>` **Color** **(** :ref:`float<class_float>` r, :ref:`float<class_float>` g, :ref:`float<class_float>` b **)**
  60. Construct the color from an RGBA profile.
  61. .. _class_Color_Color:
  62. - :ref:`Color<class_color>` **Color** **(** :ref:`int<class_int>` from **)**
  63. Construct the color from an RGBA profile.
  64. .. _class_Color_Color:
  65. - :ref:`Color<class_color>` **Color** **(** :ref:`String<class_string>` from **)**
  66. Construct the color from an RGBA profile.
  67. .. _class_Color_blend:
  68. - :ref:`Color<class_color>` **blend** **(** :ref:`Color<class_color>` over **)**
  69. Return a new color blended with anothor one.
  70. .. _class_Color_contrasted:
  71. - :ref:`Color<class_color>` **contrasted** **(** **)**
  72. Return the most contrasting color with this one.
  73. .. _class_Color_gray:
  74. - :ref:`float<class_float>` **gray** **(** **)**
  75. Convert the color to gray.
  76. .. _class_Color_inverted:
  77. - :ref:`Color<class_color>` **inverted** **(** **)**
  78. Return the inverted color (1-r, 1-g, 1-b, 1-a).
  79. .. _class_Color_linear_interpolate:
  80. - :ref:`Color<class_color>` **linear_interpolate** **(** :ref:`Color<class_color>` b, :ref:`float<class_float>` t **)**
  81. Return the linear interpolation with another color.
  82. .. _class_Color_to_32:
  83. - :ref:`int<class_int>` **to_32** **(** **)**
  84. Convert the color to a 32 its integer (each byte represents a RGBA).
  85. .. _class_Color_to_ARGB32:
  86. - :ref:`int<class_int>` **to_ARGB32** **(** **)**
  87. Convert color to ARGB32, more compatible with DirectX.
  88. .. _class_Color_to_html:
  89. - :ref:`String<class_string>` **to_html** **(** :ref:`bool<class_bool>` with_alpha=True **)**
  90. Return the HTML hexadecimal color string.