class_color.rst 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/Color.xml.
  6. .. _class_Color:
  7. Color
  8. =====
  9. Color in RGBA format using floats on the range of 0 to 1.
  10. .. rst-class:: classref-introduction-group
  11. Description
  12. -----------
  13. A color represented by red, green, blue, and alpha (RGBA) components. The alpha component is often used for opacity. Values are in floating-point and usually range from 0 to 1. Some properties (such as CanvasItem.modulate) may accept values greater than 1 (overbright or HDR colors).
  14. You can also create a color from standardized color names by using :ref:`@GDScript.ColorN<class_@GDScript_method_ColorN>` or directly using the color constants defined here. The standardized color set is based on the `X11 color names <https://en.wikipedia.org/wiki/X11_color_names>`__.
  15. If you want to supply values in a range of 0 to 255, you should use :ref:`@GDScript.Color8<class_@GDScript_method_Color8>`.
  16. \ **Note:** In a boolean context, a Color will evaluate to ``false`` if it's equal to ``Color(0, 0, 0, 1)`` (opaque black). Otherwise, a Color will always evaluate to ``true``.
  17. \ `Color constants cheatsheet <https://raw.githubusercontent.com/godotengine/godot-docs/master/img/color_constants.png>`__
  18. .. rst-class:: classref-introduction-group
  19. Tutorials
  20. ---------
  21. - `2D GD Paint Demo <https://godotengine.org/asset-library/asset/517>`__
  22. - `Tween Demo <https://godotengine.org/asset-library/asset/146>`__
  23. - `GUI Drag And Drop Demo <https://godotengine.org/asset-library/asset/133>`__
  24. .. rst-class:: classref-reftable-group
  25. Properties
  26. ----------
  27. .. table::
  28. :widths: auto
  29. +---------------------------+------------------------------------+---------+
  30. | :ref:`float<class_float>` | :ref:`a<class_Color_property_a>` | ``1.0`` |
  31. +---------------------------+------------------------------------+---------+
  32. | :ref:`int<class_int>` | :ref:`a8<class_Color_property_a8>` | ``255`` |
  33. +---------------------------+------------------------------------+---------+
  34. | :ref:`float<class_float>` | :ref:`b<class_Color_property_b>` | ``0.0`` |
  35. +---------------------------+------------------------------------+---------+
  36. | :ref:`int<class_int>` | :ref:`b8<class_Color_property_b8>` | ``0`` |
  37. +---------------------------+------------------------------------+---------+
  38. | :ref:`float<class_float>` | :ref:`g<class_Color_property_g>` | ``0.0`` |
  39. +---------------------------+------------------------------------+---------+
  40. | :ref:`int<class_int>` | :ref:`g8<class_Color_property_g8>` | ``0`` |
  41. +---------------------------+------------------------------------+---------+
  42. | :ref:`float<class_float>` | :ref:`h<class_Color_property_h>` | ``0.0`` |
  43. +---------------------------+------------------------------------+---------+
  44. | :ref:`float<class_float>` | :ref:`r<class_Color_property_r>` | ``0.0`` |
  45. +---------------------------+------------------------------------+---------+
  46. | :ref:`int<class_int>` | :ref:`r8<class_Color_property_r8>` | ``0`` |
  47. +---------------------------+------------------------------------+---------+
  48. | :ref:`float<class_float>` | :ref:`s<class_Color_property_s>` | ``0.0`` |
  49. +---------------------------+------------------------------------+---------+
  50. | :ref:`float<class_float>` | :ref:`v<class_Color_property_v>` | ``0.0`` |
  51. +---------------------------+------------------------------------+---------+
  52. .. rst-class:: classref-reftable-group
  53. Methods
  54. -------
  55. .. table::
  56. :widths: auto
  57. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`Color<class_Color>` | :ref:`Color<class_Color_method_Color>` **(** :ref:`String<class_String>` from **)** |
  59. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`Color<class_Color>` | :ref:`Color<class_Color_method_Color>` **(** :ref:`int<class_int>` from **)** |
  61. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`Color<class_Color>` | :ref:`Color<class_Color_method_Color>` **(** :ref:`Color<class_Color>` from, :ref:`float<class_float>` alpha **)** |
  63. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | :ref:`Color<class_Color>` | :ref:`Color<class_Color_method_Color>` **(** :ref:`float<class_float>` r, :ref:`float<class_float>` g, :ref:`float<class_float>` b **)** |
  65. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`Color<class_Color>` | :ref:`Color<class_Color_method_Color>` **(** :ref:`float<class_float>` r, :ref:`float<class_float>` g, :ref:`float<class_float>` b, :ref:`float<class_float>` a **)** |
  67. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`Color<class_Color>` | :ref:`blend<class_Color_method_blend>` **(** :ref:`Color<class_Color>` over **)** |
  69. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`Color<class_Color>` | :ref:`contrasted<class_Color_method_contrasted>` **(** **)** |
  71. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :ref:`Color<class_Color>` | :ref:`darkened<class_Color_method_darkened>` **(** :ref:`float<class_float>` amount **)** |
  73. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :ref:`Color<class_Color>` | :ref:`from_hsv<class_Color_method_from_hsv>` **(** :ref:`float<class_float>` h, :ref:`float<class_float>` s, :ref:`float<class_float>` v, :ref:`float<class_float>` a=1.0 **)** |
  75. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | :ref:`float<class_float>` | :ref:`get_luminance<class_Color_method_get_luminance>` **(** **)** |
  77. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | :ref:`float<class_float>` | :ref:`gray<class_Color_method_gray>` **(** **)** |
  79. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | :ref:`Color<class_Color>` | :ref:`inverted<class_Color_method_inverted>` **(** **)** |
  81. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | :ref:`bool<class_bool>` | :ref:`is_equal_approx<class_Color_method_is_equal_approx>` **(** :ref:`Color<class_Color>` color **)** |
  83. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | :ref:`Color<class_Color>` | :ref:`lightened<class_Color_method_lightened>` **(** :ref:`float<class_float>` amount **)** |
  85. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | :ref:`Color<class_Color>` | :ref:`linear_interpolate<class_Color_method_linear_interpolate>` **(** :ref:`Color<class_Color>` to, :ref:`float<class_float>` weight **)** |
  87. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | :ref:`int<class_int>` | :ref:`to_abgr32<class_Color_method_to_abgr32>` **(** **)** |
  89. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | :ref:`int<class_int>` | :ref:`to_abgr64<class_Color_method_to_abgr64>` **(** **)** |
  91. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | :ref:`int<class_int>` | :ref:`to_argb32<class_Color_method_to_argb32>` **(** **)** |
  93. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | :ref:`int<class_int>` | :ref:`to_argb64<class_Color_method_to_argb64>` **(** **)** |
  95. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | :ref:`String<class_String>` | :ref:`to_html<class_Color_method_to_html>` **(** :ref:`bool<class_bool>` with_alpha=true **)** |
  97. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | :ref:`int<class_int>` | :ref:`to_rgba32<class_Color_method_to_rgba32>` **(** **)** |
  99. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | :ref:`int<class_int>` | :ref:`to_rgba64<class_Color_method_to_rgba64>` **(** **)** |
  101. +-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. .. rst-class:: classref-section-separator
  103. ----
  104. .. rst-class:: classref-descriptions-group
  105. Constants
  106. ---------
  107. .. _class_Color_constant_aliceblue:
  108. .. rst-class:: classref-constant
  109. **aliceblue** = ``Color( 0.941176, 0.972549, 1, 1 )``
  110. Alice blue color.
  111. .. _class_Color_constant_antiquewhite:
  112. .. rst-class:: classref-constant
  113. **antiquewhite** = ``Color( 0.980392, 0.921569, 0.843137, 1 )``
  114. Antique white color.
  115. .. _class_Color_constant_aqua:
  116. .. rst-class:: classref-constant
  117. **aqua** = ``Color( 0, 1, 1, 1 )``
  118. Aqua color.
  119. .. _class_Color_constant_aquamarine:
  120. .. rst-class:: classref-constant
  121. **aquamarine** = ``Color( 0.498039, 1, 0.831373, 1 )``
  122. Aquamarine color.
  123. .. _class_Color_constant_azure:
  124. .. rst-class:: classref-constant
  125. **azure** = ``Color( 0.941176, 1, 1, 1 )``
  126. Azure color.
  127. .. _class_Color_constant_beige:
  128. .. rst-class:: classref-constant
  129. **beige** = ``Color( 0.960784, 0.960784, 0.862745, 1 )``
  130. Beige color.
  131. .. _class_Color_constant_bisque:
  132. .. rst-class:: classref-constant
  133. **bisque** = ``Color( 1, 0.894118, 0.768627, 1 )``
  134. Bisque color.
  135. .. _class_Color_constant_black:
  136. .. rst-class:: classref-constant
  137. **black** = ``Color( 0, 0, 0, 1 )``
  138. Black color.
  139. .. _class_Color_constant_blanchedalmond:
  140. .. rst-class:: classref-constant
  141. **blanchedalmond** = ``Color( 1, 0.921569, 0.803922, 1 )``
  142. Blanche almond color.
  143. .. _class_Color_constant_blue:
  144. .. rst-class:: classref-constant
  145. **blue** = ``Color( 0, 0, 1, 1 )``
  146. Blue color.
  147. .. _class_Color_constant_blueviolet:
  148. .. rst-class:: classref-constant
  149. **blueviolet** = ``Color( 0.541176, 0.168627, 0.886275, 1 )``
  150. Blue violet color.
  151. .. _class_Color_constant_brown:
  152. .. rst-class:: classref-constant
  153. **brown** = ``Color( 0.647059, 0.164706, 0.164706, 1 )``
  154. Brown color.
  155. .. _class_Color_constant_burlywood:
  156. .. rst-class:: classref-constant
  157. **burlywood** = ``Color( 0.870588, 0.721569, 0.529412, 1 )``
  158. Burly wood color.
  159. .. _class_Color_constant_cadetblue:
  160. .. rst-class:: classref-constant
  161. **cadetblue** = ``Color( 0.372549, 0.619608, 0.627451, 1 )``
  162. Cadet blue color.
  163. .. _class_Color_constant_chartreuse:
  164. .. rst-class:: classref-constant
  165. **chartreuse** = ``Color( 0.498039, 1, 0, 1 )``
  166. Chartreuse color.
  167. .. _class_Color_constant_chocolate:
  168. .. rst-class:: classref-constant
  169. **chocolate** = ``Color( 0.823529, 0.411765, 0.117647, 1 )``
  170. Chocolate color.
  171. .. _class_Color_constant_coral:
  172. .. rst-class:: classref-constant
  173. **coral** = ``Color( 1, 0.498039, 0.313726, 1 )``
  174. Coral color.
  175. .. _class_Color_constant_cornflower:
  176. .. rst-class:: classref-constant
  177. **cornflower** = ``Color( 0.392157, 0.584314, 0.929412, 1 )``
  178. Cornflower color.
  179. .. _class_Color_constant_cornsilk:
  180. .. rst-class:: classref-constant
  181. **cornsilk** = ``Color( 1, 0.972549, 0.862745, 1 )``
  182. Corn silk color.
  183. .. _class_Color_constant_crimson:
  184. .. rst-class:: classref-constant
  185. **crimson** = ``Color( 0.862745, 0.0784314, 0.235294, 1 )``
  186. Crimson color.
  187. .. _class_Color_constant_cyan:
  188. .. rst-class:: classref-constant
  189. **cyan** = ``Color( 0, 1, 1, 1 )``
  190. Cyan color.
  191. .. _class_Color_constant_darkblue:
  192. .. rst-class:: classref-constant
  193. **darkblue** = ``Color( 0, 0, 0.545098, 1 )``
  194. Dark blue color.
  195. .. _class_Color_constant_darkcyan:
  196. .. rst-class:: classref-constant
  197. **darkcyan** = ``Color( 0, 0.545098, 0.545098, 1 )``
  198. Dark cyan color.
  199. .. _class_Color_constant_darkgoldenrod:
  200. .. rst-class:: classref-constant
  201. **darkgoldenrod** = ``Color( 0.721569, 0.52549, 0.0431373, 1 )``
  202. Dark goldenrod color.
  203. .. _class_Color_constant_darkgray:
  204. .. rst-class:: classref-constant
  205. **darkgray** = ``Color( 0.662745, 0.662745, 0.662745, 1 )``
  206. Dark gray color.
  207. .. _class_Color_constant_darkgreen:
  208. .. rst-class:: classref-constant
  209. **darkgreen** = ``Color( 0, 0.392157, 0, 1 )``
  210. Dark green color.
  211. .. _class_Color_constant_darkkhaki:
  212. .. rst-class:: classref-constant
  213. **darkkhaki** = ``Color( 0.741176, 0.717647, 0.419608, 1 )``
  214. Dark khaki color.
  215. .. _class_Color_constant_darkmagenta:
  216. .. rst-class:: classref-constant
  217. **darkmagenta** = ``Color( 0.545098, 0, 0.545098, 1 )``
  218. Dark magenta color.
  219. .. _class_Color_constant_darkolivegreen:
  220. .. rst-class:: classref-constant
  221. **darkolivegreen** = ``Color( 0.333333, 0.419608, 0.184314, 1 )``
  222. Dark olive green color.
  223. .. _class_Color_constant_darkorange:
  224. .. rst-class:: classref-constant
  225. **darkorange** = ``Color( 1, 0.54902, 0, 1 )``
  226. Dark orange color.
  227. .. _class_Color_constant_darkorchid:
  228. .. rst-class:: classref-constant
  229. **darkorchid** = ``Color( 0.6, 0.196078, 0.8, 1 )``
  230. Dark orchid color.
  231. .. _class_Color_constant_darkred:
  232. .. rst-class:: classref-constant
  233. **darkred** = ``Color( 0.545098, 0, 0, 1 )``
  234. Dark red color.
  235. .. _class_Color_constant_darksalmon:
  236. .. rst-class:: classref-constant
  237. **darksalmon** = ``Color( 0.913725, 0.588235, 0.478431, 1 )``
  238. Dark salmon color.
  239. .. _class_Color_constant_darkseagreen:
  240. .. rst-class:: classref-constant
  241. **darkseagreen** = ``Color( 0.560784, 0.737255, 0.560784, 1 )``
  242. Dark sea green color.
  243. .. _class_Color_constant_darkslateblue:
  244. .. rst-class:: classref-constant
  245. **darkslateblue** = ``Color( 0.282353, 0.239216, 0.545098, 1 )``
  246. Dark slate blue color.
  247. .. _class_Color_constant_darkslategray:
  248. .. rst-class:: classref-constant
  249. **darkslategray** = ``Color( 0.184314, 0.309804, 0.309804, 1 )``
  250. Dark slate gray color.
  251. .. _class_Color_constant_darkturquoise:
  252. .. rst-class:: classref-constant
  253. **darkturquoise** = ``Color( 0, 0.807843, 0.819608, 1 )``
  254. Dark turquoise color.
  255. .. _class_Color_constant_darkviolet:
  256. .. rst-class:: classref-constant
  257. **darkviolet** = ``Color( 0.580392, 0, 0.827451, 1 )``
  258. Dark violet color.
  259. .. _class_Color_constant_deeppink:
  260. .. rst-class:: classref-constant
  261. **deeppink** = ``Color( 1, 0.0784314, 0.576471, 1 )``
  262. Deep pink color.
  263. .. _class_Color_constant_deepskyblue:
  264. .. rst-class:: classref-constant
  265. **deepskyblue** = ``Color( 0, 0.74902, 1, 1 )``
  266. Deep sky blue color.
  267. .. _class_Color_constant_dimgray:
  268. .. rst-class:: classref-constant
  269. **dimgray** = ``Color( 0.411765, 0.411765, 0.411765, 1 )``
  270. Dim gray color.
  271. .. _class_Color_constant_dodgerblue:
  272. .. rst-class:: classref-constant
  273. **dodgerblue** = ``Color( 0.117647, 0.564706, 1, 1 )``
  274. Dodger blue color.
  275. .. _class_Color_constant_firebrick:
  276. .. rst-class:: classref-constant
  277. **firebrick** = ``Color( 0.698039, 0.133333, 0.133333, 1 )``
  278. Firebrick color.
  279. .. _class_Color_constant_floralwhite:
  280. .. rst-class:: classref-constant
  281. **floralwhite** = ``Color( 1, 0.980392, 0.941176, 1 )``
  282. Floral white color.
  283. .. _class_Color_constant_forestgreen:
  284. .. rst-class:: classref-constant
  285. **forestgreen** = ``Color( 0.133333, 0.545098, 0.133333, 1 )``
  286. Forest green color.
  287. .. _class_Color_constant_fuchsia:
  288. .. rst-class:: classref-constant
  289. **fuchsia** = ``Color( 1, 0, 1, 1 )``
  290. Fuchsia color.
  291. .. _class_Color_constant_gainsboro:
  292. .. rst-class:: classref-constant
  293. **gainsboro** = ``Color( 0.862745, 0.862745, 0.862745, 1 )``
  294. Gainsboro color.
  295. .. _class_Color_constant_ghostwhite:
  296. .. rst-class:: classref-constant
  297. **ghostwhite** = ``Color( 0.972549, 0.972549, 1, 1 )``
  298. Ghost white color.
  299. .. _class_Color_constant_gold:
  300. .. rst-class:: classref-constant
  301. **gold** = ``Color( 1, 0.843137, 0, 1 )``
  302. Gold color.
  303. .. _class_Color_constant_goldenrod:
  304. .. rst-class:: classref-constant
  305. **goldenrod** = ``Color( 0.854902, 0.647059, 0.12549, 1 )``
  306. Goldenrod color.
  307. .. _class_Color_constant_gray:
  308. .. rst-class:: classref-constant
  309. **gray** = ``Color( 0.745098, 0.745098, 0.745098, 1 )``
  310. Gray color.
  311. .. _class_Color_constant_green:
  312. .. rst-class:: classref-constant
  313. **green** = ``Color( 0, 1, 0, 1 )``
  314. Green color.
  315. .. _class_Color_constant_greenyellow:
  316. .. rst-class:: classref-constant
  317. **greenyellow** = ``Color( 0.678431, 1, 0.184314, 1 )``
  318. Green yellow color.
  319. .. _class_Color_constant_honeydew:
  320. .. rst-class:: classref-constant
  321. **honeydew** = ``Color( 0.941176, 1, 0.941176, 1 )``
  322. Honeydew color.
  323. .. _class_Color_constant_hotpink:
  324. .. rst-class:: classref-constant
  325. **hotpink** = ``Color( 1, 0.411765, 0.705882, 1 )``
  326. Hot pink color.
  327. .. _class_Color_constant_indianred:
  328. .. rst-class:: classref-constant
  329. **indianred** = ``Color( 0.803922, 0.360784, 0.360784, 1 )``
  330. Indian red color.
  331. .. _class_Color_constant_indigo:
  332. .. rst-class:: classref-constant
  333. **indigo** = ``Color( 0.294118, 0, 0.509804, 1 )``
  334. Indigo color.
  335. .. _class_Color_constant_ivory:
  336. .. rst-class:: classref-constant
  337. **ivory** = ``Color( 1, 1, 0.941176, 1 )``
  338. Ivory color.
  339. .. _class_Color_constant_khaki:
  340. .. rst-class:: classref-constant
  341. **khaki** = ``Color( 0.941176, 0.901961, 0.54902, 1 )``
  342. Khaki color.
  343. .. _class_Color_constant_lavender:
  344. .. rst-class:: classref-constant
  345. **lavender** = ``Color( 0.901961, 0.901961, 0.980392, 1 )``
  346. Lavender color.
  347. .. _class_Color_constant_lavenderblush:
  348. .. rst-class:: classref-constant
  349. **lavenderblush** = ``Color( 1, 0.941176, 0.960784, 1 )``
  350. Lavender blush color.
  351. .. _class_Color_constant_lawngreen:
  352. .. rst-class:: classref-constant
  353. **lawngreen** = ``Color( 0.486275, 0.988235, 0, 1 )``
  354. Lawn green color.
  355. .. _class_Color_constant_lemonchiffon:
  356. .. rst-class:: classref-constant
  357. **lemonchiffon** = ``Color( 1, 0.980392, 0.803922, 1 )``
  358. Lemon chiffon color.
  359. .. _class_Color_constant_lightblue:
  360. .. rst-class:: classref-constant
  361. **lightblue** = ``Color( 0.678431, 0.847059, 0.901961, 1 )``
  362. Light blue color.
  363. .. _class_Color_constant_lightcoral:
  364. .. rst-class:: classref-constant
  365. **lightcoral** = ``Color( 0.941176, 0.501961, 0.501961, 1 )``
  366. Light coral color.
  367. .. _class_Color_constant_lightcyan:
  368. .. rst-class:: classref-constant
  369. **lightcyan** = ``Color( 0.878431, 1, 1, 1 )``
  370. Light cyan color.
  371. .. _class_Color_constant_lightgoldenrod:
  372. .. rst-class:: classref-constant
  373. **lightgoldenrod** = ``Color( 0.980392, 0.980392, 0.823529, 1 )``
  374. Light goldenrod color.
  375. .. _class_Color_constant_lightgray:
  376. .. rst-class:: classref-constant
  377. **lightgray** = ``Color( 0.827451, 0.827451, 0.827451, 1 )``
  378. Light gray color.
  379. .. _class_Color_constant_lightgreen:
  380. .. rst-class:: classref-constant
  381. **lightgreen** = ``Color( 0.564706, 0.933333, 0.564706, 1 )``
  382. Light green color.
  383. .. _class_Color_constant_lightpink:
  384. .. rst-class:: classref-constant
  385. **lightpink** = ``Color( 1, 0.713726, 0.756863, 1 )``
  386. Light pink color.
  387. .. _class_Color_constant_lightsalmon:
  388. .. rst-class:: classref-constant
  389. **lightsalmon** = ``Color( 1, 0.627451, 0.478431, 1 )``
  390. Light salmon color.
  391. .. _class_Color_constant_lightseagreen:
  392. .. rst-class:: classref-constant
  393. **lightseagreen** = ``Color( 0.12549, 0.698039, 0.666667, 1 )``
  394. Light sea green color.
  395. .. _class_Color_constant_lightskyblue:
  396. .. rst-class:: classref-constant
  397. **lightskyblue** = ``Color( 0.529412, 0.807843, 0.980392, 1 )``
  398. Light sky blue color.
  399. .. _class_Color_constant_lightslategray:
  400. .. rst-class:: classref-constant
  401. **lightslategray** = ``Color( 0.466667, 0.533333, 0.6, 1 )``
  402. Light slate gray color.
  403. .. _class_Color_constant_lightsteelblue:
  404. .. rst-class:: classref-constant
  405. **lightsteelblue** = ``Color( 0.690196, 0.768627, 0.870588, 1 )``
  406. Light steel blue color.
  407. .. _class_Color_constant_lightyellow:
  408. .. rst-class:: classref-constant
  409. **lightyellow** = ``Color( 1, 1, 0.878431, 1 )``
  410. Light yellow color.
  411. .. _class_Color_constant_lime:
  412. .. rst-class:: classref-constant
  413. **lime** = ``Color( 0, 1, 0, 1 )``
  414. Lime color.
  415. .. _class_Color_constant_limegreen:
  416. .. rst-class:: classref-constant
  417. **limegreen** = ``Color( 0.196078, 0.803922, 0.196078, 1 )``
  418. Lime green color.
  419. .. _class_Color_constant_linen:
  420. .. rst-class:: classref-constant
  421. **linen** = ``Color( 0.980392, 0.941176, 0.901961, 1 )``
  422. Linen color.
  423. .. _class_Color_constant_magenta:
  424. .. rst-class:: classref-constant
  425. **magenta** = ``Color( 1, 0, 1, 1 )``
  426. Magenta color.
  427. .. _class_Color_constant_maroon:
  428. .. rst-class:: classref-constant
  429. **maroon** = ``Color( 0.690196, 0.188235, 0.376471, 1 )``
  430. Maroon color.
  431. .. _class_Color_constant_mediumaquamarine:
  432. .. rst-class:: classref-constant
  433. **mediumaquamarine** = ``Color( 0.4, 0.803922, 0.666667, 1 )``
  434. Medium aquamarine color.
  435. .. _class_Color_constant_mediumblue:
  436. .. rst-class:: classref-constant
  437. **mediumblue** = ``Color( 0, 0, 0.803922, 1 )``
  438. Medium blue color.
  439. .. _class_Color_constant_mediumorchid:
  440. .. rst-class:: classref-constant
  441. **mediumorchid** = ``Color( 0.729412, 0.333333, 0.827451, 1 )``
  442. Medium orchid color.
  443. .. _class_Color_constant_mediumpurple:
  444. .. rst-class:: classref-constant
  445. **mediumpurple** = ``Color( 0.576471, 0.439216, 0.858824, 1 )``
  446. Medium purple color.
  447. .. _class_Color_constant_mediumseagreen:
  448. .. rst-class:: classref-constant
  449. **mediumseagreen** = ``Color( 0.235294, 0.701961, 0.443137, 1 )``
  450. Medium sea green color.
  451. .. _class_Color_constant_mediumslateblue:
  452. .. rst-class:: classref-constant
  453. **mediumslateblue** = ``Color( 0.482353, 0.407843, 0.933333, 1 )``
  454. Medium slate blue color.
  455. .. _class_Color_constant_mediumspringgreen:
  456. .. rst-class:: classref-constant
  457. **mediumspringgreen** = ``Color( 0, 0.980392, 0.603922, 1 )``
  458. Medium spring green color.
  459. .. _class_Color_constant_mediumturquoise:
  460. .. rst-class:: classref-constant
  461. **mediumturquoise** = ``Color( 0.282353, 0.819608, 0.8, 1 )``
  462. Medium turquoise color.
  463. .. _class_Color_constant_mediumvioletred:
  464. .. rst-class:: classref-constant
  465. **mediumvioletred** = ``Color( 0.780392, 0.0823529, 0.521569, 1 )``
  466. Medium violet red color.
  467. .. _class_Color_constant_midnightblue:
  468. .. rst-class:: classref-constant
  469. **midnightblue** = ``Color( 0.0980392, 0.0980392, 0.439216, 1 )``
  470. Midnight blue color.
  471. .. _class_Color_constant_mintcream:
  472. .. rst-class:: classref-constant
  473. **mintcream** = ``Color( 0.960784, 1, 0.980392, 1 )``
  474. Mint cream color.
  475. .. _class_Color_constant_mistyrose:
  476. .. rst-class:: classref-constant
  477. **mistyrose** = ``Color( 1, 0.894118, 0.882353, 1 )``
  478. Misty rose color.
  479. .. _class_Color_constant_moccasin:
  480. .. rst-class:: classref-constant
  481. **moccasin** = ``Color( 1, 0.894118, 0.709804, 1 )``
  482. Moccasin color.
  483. .. _class_Color_constant_navajowhite:
  484. .. rst-class:: classref-constant
  485. **navajowhite** = ``Color( 1, 0.870588, 0.678431, 1 )``
  486. Navajo white color.
  487. .. _class_Color_constant_navyblue:
  488. .. rst-class:: classref-constant
  489. **navyblue** = ``Color( 0, 0, 0.501961, 1 )``
  490. Navy blue color.
  491. .. _class_Color_constant_oldlace:
  492. .. rst-class:: classref-constant
  493. **oldlace** = ``Color( 0.992157, 0.960784, 0.901961, 1 )``
  494. Old lace color.
  495. .. _class_Color_constant_olive:
  496. .. rst-class:: classref-constant
  497. **olive** = ``Color( 0.501961, 0.501961, 0, 1 )``
  498. Olive color.
  499. .. _class_Color_constant_olivedrab:
  500. .. rst-class:: classref-constant
  501. **olivedrab** = ``Color( 0.419608, 0.556863, 0.137255, 1 )``
  502. Olive drab color.
  503. .. _class_Color_constant_orange:
  504. .. rst-class:: classref-constant
  505. **orange** = ``Color( 1, 0.647059, 0, 1 )``
  506. Orange color.
  507. .. _class_Color_constant_orangered:
  508. .. rst-class:: classref-constant
  509. **orangered** = ``Color( 1, 0.270588, 0, 1 )``
  510. Orange red color.
  511. .. _class_Color_constant_orchid:
  512. .. rst-class:: classref-constant
  513. **orchid** = ``Color( 0.854902, 0.439216, 0.839216, 1 )``
  514. Orchid color.
  515. .. _class_Color_constant_palegoldenrod:
  516. .. rst-class:: classref-constant
  517. **palegoldenrod** = ``Color( 0.933333, 0.909804, 0.666667, 1 )``
  518. Pale goldenrod color.
  519. .. _class_Color_constant_palegreen:
  520. .. rst-class:: classref-constant
  521. **palegreen** = ``Color( 0.596078, 0.984314, 0.596078, 1 )``
  522. Pale green color.
  523. .. _class_Color_constant_paleturquoise:
  524. .. rst-class:: classref-constant
  525. **paleturquoise** = ``Color( 0.686275, 0.933333, 0.933333, 1 )``
  526. Pale turquoise color.
  527. .. _class_Color_constant_palevioletred:
  528. .. rst-class:: classref-constant
  529. **palevioletred** = ``Color( 0.858824, 0.439216, 0.576471, 1 )``
  530. Pale violet red color.
  531. .. _class_Color_constant_papayawhip:
  532. .. rst-class:: classref-constant
  533. **papayawhip** = ``Color( 1, 0.937255, 0.835294, 1 )``
  534. Papaya whip color.
  535. .. _class_Color_constant_peachpuff:
  536. .. rst-class:: classref-constant
  537. **peachpuff** = ``Color( 1, 0.854902, 0.72549, 1 )``
  538. Peach puff color.
  539. .. _class_Color_constant_peru:
  540. .. rst-class:: classref-constant
  541. **peru** = ``Color( 0.803922, 0.521569, 0.247059, 1 )``
  542. Peru color.
  543. .. _class_Color_constant_pink:
  544. .. rst-class:: classref-constant
  545. **pink** = ``Color( 1, 0.752941, 0.796078, 1 )``
  546. Pink color.
  547. .. _class_Color_constant_plum:
  548. .. rst-class:: classref-constant
  549. **plum** = ``Color( 0.866667, 0.627451, 0.866667, 1 )``
  550. Plum color.
  551. .. _class_Color_constant_powderblue:
  552. .. rst-class:: classref-constant
  553. **powderblue** = ``Color( 0.690196, 0.878431, 0.901961, 1 )``
  554. Powder blue color.
  555. .. _class_Color_constant_purple:
  556. .. rst-class:: classref-constant
  557. **purple** = ``Color( 0.627451, 0.12549, 0.941176, 1 )``
  558. Purple color.
  559. .. _class_Color_constant_rebeccapurple:
  560. .. rst-class:: classref-constant
  561. **rebeccapurple** = ``Color( 0.4, 0.2, 0.6, 1 )``
  562. Rebecca purple color.
  563. .. _class_Color_constant_red:
  564. .. rst-class:: classref-constant
  565. **red** = ``Color( 1, 0, 0, 1 )``
  566. Red color.
  567. .. _class_Color_constant_rosybrown:
  568. .. rst-class:: classref-constant
  569. **rosybrown** = ``Color( 0.737255, 0.560784, 0.560784, 1 )``
  570. Rosy brown color.
  571. .. _class_Color_constant_royalblue:
  572. .. rst-class:: classref-constant
  573. **royalblue** = ``Color( 0.254902, 0.411765, 0.882353, 1 )``
  574. Royal blue color.
  575. .. _class_Color_constant_saddlebrown:
  576. .. rst-class:: classref-constant
  577. **saddlebrown** = ``Color( 0.545098, 0.270588, 0.0745098, 1 )``
  578. Saddle brown color.
  579. .. _class_Color_constant_salmon:
  580. .. rst-class:: classref-constant
  581. **salmon** = ``Color( 0.980392, 0.501961, 0.447059, 1 )``
  582. Salmon color.
  583. .. _class_Color_constant_sandybrown:
  584. .. rst-class:: classref-constant
  585. **sandybrown** = ``Color( 0.956863, 0.643137, 0.376471, 1 )``
  586. Sandy brown color.
  587. .. _class_Color_constant_seagreen:
  588. .. rst-class:: classref-constant
  589. **seagreen** = ``Color( 0.180392, 0.545098, 0.341176, 1 )``
  590. Sea green color.
  591. .. _class_Color_constant_seashell:
  592. .. rst-class:: classref-constant
  593. **seashell** = ``Color( 1, 0.960784, 0.933333, 1 )``
  594. Seashell color.
  595. .. _class_Color_constant_sienna:
  596. .. rst-class:: classref-constant
  597. **sienna** = ``Color( 0.627451, 0.321569, 0.176471, 1 )``
  598. Sienna color.
  599. .. _class_Color_constant_silver:
  600. .. rst-class:: classref-constant
  601. **silver** = ``Color( 0.752941, 0.752941, 0.752941, 1 )``
  602. Silver color.
  603. .. _class_Color_constant_skyblue:
  604. .. rst-class:: classref-constant
  605. **skyblue** = ``Color( 0.529412, 0.807843, 0.921569, 1 )``
  606. Sky blue color.
  607. .. _class_Color_constant_slateblue:
  608. .. rst-class:: classref-constant
  609. **slateblue** = ``Color( 0.415686, 0.352941, 0.803922, 1 )``
  610. Slate blue color.
  611. .. _class_Color_constant_slategray:
  612. .. rst-class:: classref-constant
  613. **slategray** = ``Color( 0.439216, 0.501961, 0.564706, 1 )``
  614. Slate gray color.
  615. .. _class_Color_constant_snow:
  616. .. rst-class:: classref-constant
  617. **snow** = ``Color( 1, 0.980392, 0.980392, 1 )``
  618. Snow color.
  619. .. _class_Color_constant_springgreen:
  620. .. rst-class:: classref-constant
  621. **springgreen** = ``Color( 0, 1, 0.498039, 1 )``
  622. Spring green color.
  623. .. _class_Color_constant_steelblue:
  624. .. rst-class:: classref-constant
  625. **steelblue** = ``Color( 0.27451, 0.509804, 0.705882, 1 )``
  626. Steel blue color.
  627. .. _class_Color_constant_tan:
  628. .. rst-class:: classref-constant
  629. **tan** = ``Color( 0.823529, 0.705882, 0.54902, 1 )``
  630. Tan color.
  631. .. _class_Color_constant_teal:
  632. .. rst-class:: classref-constant
  633. **teal** = ``Color( 0, 0.501961, 0.501961, 1 )``
  634. Teal color.
  635. .. _class_Color_constant_thistle:
  636. .. rst-class:: classref-constant
  637. **thistle** = ``Color( 0.847059, 0.74902, 0.847059, 1 )``
  638. Thistle color.
  639. .. _class_Color_constant_tomato:
  640. .. rst-class:: classref-constant
  641. **tomato** = ``Color( 1, 0.388235, 0.278431, 1 )``
  642. Tomato color.
  643. .. _class_Color_constant_transparent:
  644. .. rst-class:: classref-constant
  645. **transparent** = ``Color( 1, 1, 1, 0 )``
  646. Transparent color (white with no alpha).
  647. .. _class_Color_constant_turquoise:
  648. .. rst-class:: classref-constant
  649. **turquoise** = ``Color( 0.25098, 0.878431, 0.815686, 1 )``
  650. Turquoise color.
  651. .. _class_Color_constant_violet:
  652. .. rst-class:: classref-constant
  653. **violet** = ``Color( 0.933333, 0.509804, 0.933333, 1 )``
  654. Violet color.
  655. .. _class_Color_constant_webgray:
  656. .. rst-class:: classref-constant
  657. **webgray** = ``Color( 0.501961, 0.501961, 0.501961, 1 )``
  658. Web gray color.
  659. .. _class_Color_constant_webgreen:
  660. .. rst-class:: classref-constant
  661. **webgreen** = ``Color( 0, 0.501961, 0, 1 )``
  662. Web green color.
  663. .. _class_Color_constant_webmaroon:
  664. .. rst-class:: classref-constant
  665. **webmaroon** = ``Color( 0.501961, 0, 0, 1 )``
  666. Web maroon color.
  667. .. _class_Color_constant_webpurple:
  668. .. rst-class:: classref-constant
  669. **webpurple** = ``Color( 0.501961, 0, 0.501961, 1 )``
  670. Web purple color.
  671. .. _class_Color_constant_wheat:
  672. .. rst-class:: classref-constant
  673. **wheat** = ``Color( 0.960784, 0.870588, 0.701961, 1 )``
  674. Wheat color.
  675. .. _class_Color_constant_white:
  676. .. rst-class:: classref-constant
  677. **white** = ``Color( 1, 1, 1, 1 )``
  678. White color.
  679. .. _class_Color_constant_whitesmoke:
  680. .. rst-class:: classref-constant
  681. **whitesmoke** = ``Color( 0.960784, 0.960784, 0.960784, 1 )``
  682. White smoke color.
  683. .. _class_Color_constant_yellow:
  684. .. rst-class:: classref-constant
  685. **yellow** = ``Color( 1, 1, 0, 1 )``
  686. Yellow color.
  687. .. _class_Color_constant_yellowgreen:
  688. .. rst-class:: classref-constant
  689. **yellowgreen** = ``Color( 0.603922, 0.803922, 0.196078, 1 )``
  690. Yellow green color.
  691. .. rst-class:: classref-section-separator
  692. ----
  693. .. rst-class:: classref-descriptions-group
  694. Property Descriptions
  695. ---------------------
  696. .. _class_Color_property_a:
  697. .. rst-class:: classref-property
  698. :ref:`float<class_float>` **a** = ``1.0``
  699. The color's alpha component, typically on the range of 0 to 1. A value of 0 means that the color is fully transparent. A value of 1 means that the color is fully opaque.
  700. .. rst-class:: classref-item-separator
  701. ----
  702. .. _class_Color_property_a8:
  703. .. rst-class:: classref-property
  704. :ref:`int<class_int>` **a8** = ``255``
  705. Wrapper for :ref:`a<class_Color_property_a>` that uses the range 0 to 255 instead of 0 to 1.
  706. .. rst-class:: classref-item-separator
  707. ----
  708. .. _class_Color_property_b:
  709. .. rst-class:: classref-property
  710. :ref:`float<class_float>` **b** = ``0.0``
  711. The color's blue component, typically on the range of 0 to 1.
  712. .. rst-class:: classref-item-separator
  713. ----
  714. .. _class_Color_property_b8:
  715. .. rst-class:: classref-property
  716. :ref:`int<class_int>` **b8** = ``0``
  717. Wrapper for :ref:`b<class_Color_property_b>` that uses the range 0 to 255 instead of 0 to 1.
  718. .. rst-class:: classref-item-separator
  719. ----
  720. .. _class_Color_property_g:
  721. .. rst-class:: classref-property
  722. :ref:`float<class_float>` **g** = ``0.0``
  723. The color's green component, typically on the range of 0 to 1.
  724. .. rst-class:: classref-item-separator
  725. ----
  726. .. _class_Color_property_g8:
  727. .. rst-class:: classref-property
  728. :ref:`int<class_int>` **g8** = ``0``
  729. Wrapper for :ref:`g<class_Color_property_g>` that uses the range 0 to 255 instead of 0 to 1.
  730. .. rst-class:: classref-item-separator
  731. ----
  732. .. _class_Color_property_h:
  733. .. rst-class:: classref-property
  734. :ref:`float<class_float>` **h** = ``0.0``
  735. The HSV hue of this color, on the range 0 to 1.
  736. .. rst-class:: classref-item-separator
  737. ----
  738. .. _class_Color_property_r:
  739. .. rst-class:: classref-property
  740. :ref:`float<class_float>` **r** = ``0.0``
  741. The color's red component, typically on the range of 0 to 1.
  742. .. rst-class:: classref-item-separator
  743. ----
  744. .. _class_Color_property_r8:
  745. .. rst-class:: classref-property
  746. :ref:`int<class_int>` **r8** = ``0``
  747. Wrapper for :ref:`r<class_Color_property_r>` that uses the range 0 to 255 instead of 0 to 1.
  748. .. rst-class:: classref-item-separator
  749. ----
  750. .. _class_Color_property_s:
  751. .. rst-class:: classref-property
  752. :ref:`float<class_float>` **s** = ``0.0``
  753. The HSV saturation of this color, on the range 0 to 1.
  754. .. rst-class:: classref-item-separator
  755. ----
  756. .. _class_Color_property_v:
  757. .. rst-class:: classref-property
  758. :ref:`float<class_float>` **v** = ``0.0``
  759. The HSV value (brightness) of this color, on the range 0 to 1.
  760. .. rst-class:: classref-section-separator
  761. ----
  762. .. rst-class:: classref-descriptions-group
  763. Method Descriptions
  764. -------------------
  765. .. _class_Color_method_Color:
  766. .. rst-class:: classref-method
  767. :ref:`Color<class_Color>` **Color** **(** :ref:`String<class_String>` from **)**
  768. Constructs a color from an HTML hexadecimal color string in ARGB or RGB format. See also :ref:`@GDScript.ColorN<class_@GDScript_method_ColorN>`.
  769. ::
  770. # Each of the following creates the same color RGBA(178, 217, 10, 255).
  771. var c1 = Color("#ffb2d90a") # ARGB format with "#".
  772. var c2 = Color("ffb2d90a") # ARGB format.
  773. var c3 = Color("#b2d90a") # RGB format with "#".
  774. var c4 = Color("b2d90a") # RGB format.
  775. .. rst-class:: classref-item-separator
  776. ----
  777. .. rst-class:: classref-method
  778. :ref:`Color<class_Color>` **Color** **(** :ref:`int<class_int>` from **)**
  779. Constructs a color from a 32-bit integer in RGBA format (each byte represents a color channel).
  780. ::
  781. var color = Color(274) # Similar to Color(0.0, 0.0, 0.004, 0.07)
  782. .. rst-class:: classref-item-separator
  783. ----
  784. .. rst-class:: classref-method
  785. :ref:`Color<class_Color>` **Color** **(** :ref:`Color<class_Color>` from, :ref:`float<class_float>` alpha **)**
  786. Constructs a color from the existing color, with :ref:`a<class_Color_property_a>` set to the given ``alpha`` value.
  787. ::
  788. var red = Color(Color.red, 0.2) # 20% opaque red.
  789. .. rst-class:: classref-item-separator
  790. ----
  791. .. rst-class:: classref-method
  792. :ref:`Color<class_Color>` **Color** **(** :ref:`float<class_float>` r, :ref:`float<class_float>` g, :ref:`float<class_float>` b **)**
  793. Constructs a color from RGB values, typically between 0 and 1. Alpha will be 1.
  794. ::
  795. var color = Color(0.2, 1.0, 0.7) # Similar to Color8(51, 255, 178, 255)
  796. .. rst-class:: classref-item-separator
  797. ----
  798. .. rst-class:: classref-method
  799. :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 **)**
  800. Constructs a color from RGBA values, typically between 0 and 1.
  801. ::
  802. var color = Color(0.2, 1.0, 0.7, 0.8) # Similar to Color8(51, 255, 178, 204)
  803. .. rst-class:: classref-item-separator
  804. ----
  805. .. _class_Color_method_blend:
  806. .. rst-class:: classref-method
  807. :ref:`Color<class_Color>` **blend** **(** :ref:`Color<class_Color>` over **)**
  808. Returns a new color resulting from blending this color over another. If the color is opaque, the result is also opaque. The second color may have a range of alpha values.
  809. ::
  810. var bg = Color(0.0, 1.0, 0.0, 0.5) # Green with alpha of 50%
  811. var fg = Color(1.0, 0.0, 0.0, 0.5) # Red with alpha of 50%
  812. var blended_color = bg.blend(fg) # Brown with alpha of 75%
  813. .. rst-class:: classref-item-separator
  814. ----
  815. .. _class_Color_method_contrasted:
  816. .. rst-class:: classref-method
  817. :ref:`Color<class_Color>` **contrasted** **(** **)**
  818. Returns the most contrasting color.
  819. ::
  820. var color = Color(0.3, 0.4, 0.9)
  821. var contrasted_color = color.contrasted() # Equivalent to RGBA(204, 229, 102, 255)
  822. .. rst-class:: classref-item-separator
  823. ----
  824. .. _class_Color_method_darkened:
  825. .. rst-class:: classref-method
  826. :ref:`Color<class_Color>` **darkened** **(** :ref:`float<class_float>` amount **)**
  827. Returns a new color resulting from making this color darker by the specified percentage (ratio from 0 to 1).
  828. ::
  829. var green = Color(0.0, 1.0, 0.0)
  830. var darkgreen = green.darkened(0.2) # 20% darker than regular green
  831. .. rst-class:: classref-item-separator
  832. ----
  833. .. _class_Color_method_from_hsv:
  834. .. rst-class:: classref-method
  835. :ref:`Color<class_Color>` **from_hsv** **(** :ref:`float<class_float>` h, :ref:`float<class_float>` s, :ref:`float<class_float>` v, :ref:`float<class_float>` a=1.0 **)**
  836. Constructs a color from an HSV profile. ``h``, ``s``, and ``v`` are values between 0 and 1.
  837. ::
  838. var color = Color.from_hsv(0.58, 0.5, 0.79, 0.8) # Equivalent to HSV(210, 50, 79, 0.8) or Color8(100, 151, 201, 0.8)
  839. .. rst-class:: classref-item-separator
  840. ----
  841. .. _class_Color_method_get_luminance:
  842. .. rst-class:: classref-method
  843. :ref:`float<class_float>` **get_luminance** **(** **)**
  844. Returns the luminance of the color in the ``[0.0, 1.0]`` range.
  845. This is useful when determining light or dark color. Colors with a luminance smaller than 0.5 can be generally considered dark.
  846. .. rst-class:: classref-item-separator
  847. ----
  848. .. _class_Color_method_gray:
  849. .. rst-class:: classref-method
  850. :ref:`float<class_float>` **gray** **(** **)**
  851. Returns the color's grayscale representation.
  852. The gray value is calculated as ``(r + g + b) / 3``.
  853. ::
  854. var color = Color(0.2, 0.45, 0.82)
  855. var gray = color.gray() # A value of 0.466667
  856. .. rst-class:: classref-item-separator
  857. ----
  858. .. _class_Color_method_inverted:
  859. .. rst-class:: classref-method
  860. :ref:`Color<class_Color>` **inverted** **(** **)**
  861. Returns the inverted color ``(1 - r, 1 - g, 1 - b, a)``.
  862. ::
  863. var color = Color(0.3, 0.4, 0.9)
  864. var inverted_color = color.inverted() # Equivalent to Color(0.7, 0.6, 0.1)
  865. .. rst-class:: classref-item-separator
  866. ----
  867. .. _class_Color_method_is_equal_approx:
  868. .. rst-class:: classref-method
  869. :ref:`bool<class_bool>` **is_equal_approx** **(** :ref:`Color<class_Color>` color **)**
  870. Returns ``true`` if this color and ``color`` are approximately equal, by running :ref:`@GDScript.is_equal_approx<class_@GDScript_method_is_equal_approx>` on each component.
  871. .. rst-class:: classref-item-separator
  872. ----
  873. .. _class_Color_method_lightened:
  874. .. rst-class:: classref-method
  875. :ref:`Color<class_Color>` **lightened** **(** :ref:`float<class_float>` amount **)**
  876. Returns a new color resulting from making this color lighter by the specified percentage (ratio from 0 to 1).
  877. ::
  878. var green = Color(0.0, 1.0, 0.0)
  879. var lightgreen = green.lightened(0.2) # 20% lighter than regular green
  880. .. rst-class:: classref-item-separator
  881. ----
  882. .. _class_Color_method_linear_interpolate:
  883. .. rst-class:: classref-method
  884. :ref:`Color<class_Color>` **linear_interpolate** **(** :ref:`Color<class_Color>` to, :ref:`float<class_float>` weight **)**
  885. Returns the linear interpolation with another color. The interpolation factor ``weight`` is between 0 and 1.
  886. ::
  887. var c1 = Color(1.0, 0.0, 0.0)
  888. var c2 = Color(0.0, 1.0, 0.0)
  889. var li_c = c1.linear_interpolate(c2, 0.5) # Equivalent to Color(0.5, 0.5, 0.0)
  890. .. rst-class:: classref-item-separator
  891. ----
  892. .. _class_Color_method_to_abgr32:
  893. .. rst-class:: classref-method
  894. :ref:`int<class_int>` **to_abgr32** **(** **)**
  895. Returns the color converted to a 32-bit integer in ABGR format (each byte represents a color channel). ABGR is the reversed version of the default format.
  896. ::
  897. var color = Color(1, 0.5, 0.2)
  898. print(color.to_abgr32()) # Prints 4281565439
  899. .. rst-class:: classref-item-separator
  900. ----
  901. .. _class_Color_method_to_abgr64:
  902. .. rst-class:: classref-method
  903. :ref:`int<class_int>` **to_abgr64** **(** **)**
  904. Returns the color converted to a 64-bit integer in ABGR format (each word represents a color channel). ABGR is the reversed version of the default format.
  905. ::
  906. var color = Color(1, 0.5, 0.2)
  907. print(color.to_abgr64()) # Prints -225178692812801
  908. .. rst-class:: classref-item-separator
  909. ----
  910. .. _class_Color_method_to_argb32:
  911. .. rst-class:: classref-method
  912. :ref:`int<class_int>` **to_argb32** **(** **)**
  913. Returns the color converted to a 32-bit integer in ARGB format (each byte represents a color channel). ARGB is more compatible with DirectX.
  914. ::
  915. var color = Color(1, 0.5, 0.2)
  916. print(color.to_argb32()) # Prints 4294934323
  917. .. rst-class:: classref-item-separator
  918. ----
  919. .. _class_Color_method_to_argb64:
  920. .. rst-class:: classref-method
  921. :ref:`int<class_int>` **to_argb64** **(** **)**
  922. Returns the color converted to a 64-bit integer in ARGB format (each word represents a color channel). ARGB is more compatible with DirectX.
  923. ::
  924. var color = Color(1, 0.5, 0.2)
  925. print(color.to_argb64()) # Prints -2147470541
  926. .. rst-class:: classref-item-separator
  927. ----
  928. .. _class_Color_method_to_html:
  929. .. rst-class:: classref-method
  930. :ref:`String<class_String>` **to_html** **(** :ref:`bool<class_bool>` with_alpha=true **)**
  931. Returns the color's HTML hexadecimal color string in ARGB format (ex: ``ff34f822``).
  932. Setting ``with_alpha`` to ``false`` excludes alpha from the hexadecimal string.
  933. ::
  934. var color = Color(1, 1, 1, 0.5)
  935. var s1 = color.to_html() # Returns "7fffffff"
  936. var s2 = color.to_html(false) # Returns "ffffff"
  937. .. rst-class:: classref-item-separator
  938. ----
  939. .. _class_Color_method_to_rgba32:
  940. .. rst-class:: classref-method
  941. :ref:`int<class_int>` **to_rgba32** **(** **)**
  942. Returns the color converted to a 32-bit integer in RGBA format (each byte represents a color channel). RGBA is Godot's default format.
  943. ::
  944. var color = Color(1, 0.5, 0.2)
  945. print(color.to_rgba32()) # Prints 4286526463
  946. .. rst-class:: classref-item-separator
  947. ----
  948. .. _class_Color_method_to_rgba64:
  949. .. rst-class:: classref-method
  950. :ref:`int<class_int>` **to_rgba64** **(** **)**
  951. Returns the color converted to a 64-bit integer in RGBA format (each word represents a color channel). RGBA is Godot's default format.
  952. ::
  953. var color = Color(1, 0.5, 0.2)
  954. print(color.to_rgba64()) # Prints -140736629309441
  955. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  956. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  957. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  958. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`