Difference between revisions of "love.graphics.setBackgroundColor"
m |
|||
(21 intermediate revisions by 13 users not shown) | |||
Line 1: | Line 1: | ||
Sets the background color. | Sets the background color. | ||
+ | |||
+ | {{notice|In versions prior to [[11.0]], color component values were within the range of 0 to 255 instead of 0 to 1.}} | ||
== Function == | == Function == | ||
=== Synopsis === | === Synopsis === | ||
<source lang="lua"> | <source lang="lua"> | ||
− | love.graphics.setBackgroundColor( | + | love.graphics.setBackgroundColor( red, green, blue, alpha ) |
</source> | </source> | ||
=== Arguments === | === Arguments === | ||
− | {{param|number| | + | {{param|number|red|The red component (0-1).}} |
− | {{param|number| | + | {{param|number|green|The green component (0-1).}} |
− | {{param|number| | + | {{param|number|blue|The blue component (0-1).}} |
+ | {{New feature|0.8.0| | ||
+ | {{param|number|alpha (1)|The alpha component (0-1).}} | ||
+ | |080}} | ||
=== Returns === | === Returns === | ||
Nothing. | Nothing. | ||
+ | |||
+ | == Function == | ||
+ | {{newin|[[0.7.0]]|070|type=variant}} | ||
+ | === Synopsis === | ||
+ | <source lang="lua"> | ||
+ | love.graphics.setBackgroundColor( rgb ) | ||
+ | </source> | ||
+ | === Arguments === | ||
+ | {{param|table|rgb|A numerical indexed table with the red, green and blue values as [[number]]s.}} | ||
+ | === Returns === | ||
+ | Nothing. | ||
+ | |||
+ | == Function == | ||
+ | {{newin|[[0.8.0]]|080|type=variant}} | ||
+ | === Synopsis === | ||
+ | <source lang="lua"> | ||
+ | love.graphics.setBackgroundColor( rgba ) | ||
+ | </source> | ||
+ | === Arguments === | ||
+ | {{param|table|rgba|A numerical indexed table with the red, green, blue and alpha values as [[number]]s.}} | ||
+ | === Returns === | ||
+ | Nothing. | ||
+ | |||
+ | == Examples == | ||
+ | <source lang="lua"> | ||
+ | -- set background color to #84C1EE (132, 193, 238) | ||
+ | local r, g, b = love.math.colorFromBytes(132, 193, 238) | ||
+ | love.graphics.setBackgroundColor(r, g, b) | ||
+ | |||
+ | |||
+ | function love.draw() | ||
+ | -- draw any geometry: | ||
+ | love.graphics.setColor(1,1,1) | ||
+ | love.graphics.circle('fill', 400, 300, 250) | ||
+ | love.graphics.setColor(0,0,0) | ||
+ | love.graphics.circle('line', 400, 300, 250) | ||
+ | end | ||
+ | </source> | ||
+ | |||
== See Also == | == See Also == | ||
* [[parent::love.graphics]] | * [[parent::love.graphics]] | ||
+ | * [[love.graphics.clear]] | ||
+ | * [[love.graphics.getBackgroundColor]] | ||
+ | * [[love.run]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
{{#set:Description=Sets the background color.}} | {{#set:Description=Sets the background color.}} | ||
+ | {{#set:Since=000}} | ||
+ | {{#set:Sub-Category=State}} | ||
+ | |||
== Other Languages == | == Other Languages == | ||
{{i18n|love.graphics.setBackgroundColor}} | {{i18n|love.graphics.setBackgroundColor}} |
Latest revision as of 18:32, 18 February 2024
Sets the background color.
In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. |
Contents
Function
Synopsis
love.graphics.setBackgroundColor( red, green, blue, alpha )
Arguments
number red
- The red component (0-1).
number green
- The green component (0-1).
number blue
- The blue component (0-1).
Available since LÖVE 0.8.0
number alpha (1)
- The alpha component (0-1).
Returns
Nothing.
Function
Available since LÖVE 0.7.0 |
This variant is not supported in earlier versions. |
Synopsis
love.graphics.setBackgroundColor( rgb )
Arguments
Returns
Nothing.
Function
Available since LÖVE 0.8.0 |
This variant is not supported in earlier versions. |
Synopsis
love.graphics.setBackgroundColor( rgba )
Arguments
Returns
Nothing.
Examples
-- set background color to #84C1EE (132, 193, 238)
local r, g, b = love.math.colorFromBytes(132, 193, 238)
love.graphics.setBackgroundColor(r, g, b)
function love.draw()
-- draw any geometry:
love.graphics.setColor(1,1,1)
love.graphics.circle('fill', 400, 300, 250)
love.graphics.setColor(0,0,0)
love.graphics.circle('line', 400, 300, 250)
end
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info