Skip to content

Commit

Permalink
updated (#2469)
Browse files Browse the repository at this point in the history
  • Loading branch information
DragonMoffon committed Dec 8, 2024
1 parent 33c368d commit f8b0c11
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion arcade/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,9 @@ def __init__(
self, window: Window | None = None, background_color: RGBOrA255 | None = None
) -> None:
self.window = arcade.get_window() if window is None else window
self.background_color: RGBOrA255 | None = background_color
self._background_color: Color | None = background_color and Color.from_iterable(
background_color
)

def clear(
self,
Expand Down Expand Up @@ -1570,3 +1572,32 @@ def center_y(self) -> float:
An alias for `arcade.Window.center_y`
"""
return self.window.center_y

@property
def background_color(self) -> Color | None:
"""
Get or set the background color for this window.
This affects what color the window will contain when
:py:meth:`~arcade.Window.clear` is called.
Examples::
# Use Arcade's built in Color values
window.background_color = arcade.color.AMAZON
# Set the background color with a custom Color instance
MY_RED = arcade.types.Color(255, 0, 0)
window.background_color = MY_RED
# Set the background color directly from an RGBA tuple
window.background_color = 255, 0, 0, 255
# Set the background color directly from an RGB tuple
# RGB tuples will assume 255 as the opacity / alpha value
window.background_color = 255, 0, 0
"""
return self._background_color

@background_color.setter
def background_color(self, value: RGBOrA255) -> None:
self._background_color = Color.from_iterable(value)

0 comments on commit f8b0c11

Please sign in to comment.