Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion arcade/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from arcade import get_display_size
from arcade import set_viewport
from arcade import set_window
from arcade.color import TRANSPARENT_BLACK
from arcade.context import ArcadeContext
from arcade.arcade_types import Color
from arcade import SectionManager
Expand Down Expand Up @@ -176,7 +177,7 @@ def __init__(

self._ctx: ArcadeContext = ArcadeContext(self, gc_mode=gc_mode, gl_api=gl_api)
set_viewport(0, self.width, 0, self.height)
self._background_color: Color = (0, 0, 0, 0)
self._background_color: Color = TRANSPARENT_BLACK

# See if we should center the window
if center_window:
Expand Down
1 change: 1 addition & 0 deletions arcade/color/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,7 @@
TROLLEY_GREY = (128, 128, 128, 255)
TROPICAL_RAIN_FOREST = (0, 117, 94, 255)
TRUE_BLUE = (0, 115, 207, 255)
TRANSPARENT_BLACK = (0, 0, 0, 0)
TUFTS_BLUE = (65, 125, 193, 255)
TULIP = (255, 135, 141, 255)
TUMBLEWEED = (222, 170, 136, 255)
Expand Down
2 changes: 1 addition & 1 deletion arcade/examples/bloom_defender.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def on_draw(self):

# Draw to the 'bloom' layer
self.bloom_screen.use()
self.bloom_screen.clear((0, 0, 0, 0))
self.bloom_screen.clear(arcade.color.TRANSPARENT_BLACK)

arcade.set_viewport(self.view_left,
SCREEN_WIDTH + self.view_left,
Expand Down
4 changes: 2 additions & 2 deletions arcade/experimental/bloom_multilayer_defender.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def on_draw(self):

# Draw to the 'slight bloom' layer
self.slight_bloom_screen.use()
self.slight_bloom_screen.clear((0, 0, 0, 0))
self.slight_bloom_screen.clear(arcade.color.TRANSPARENT_BLACK)

arcade.set_viewport(self.view_left,
SCREEN_WIDTH + self.view_left,
Expand All @@ -262,7 +262,7 @@ def on_draw(self):

# # Draw to the 'intense bloom' layer
self.intense_bloom_screen.use()
self.intense_bloom_screen.clear((0, 0, 0, 0))
self.intense_bloom_screen.clear(arcade.color.TRANSPARENT_BLACK)

arcade.set_viewport(self.view_left,
SCREEN_WIDTH + self.view_left,
Expand Down
3 changes: 2 additions & 1 deletion arcade/gui/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import arcade
from arcade import Texture
from arcade.color import TRANSPARENT_BLACK
from arcade.gl import Framebuffer
from arcade.gl import geometry
from arcade.gui.nine_patch import NinePatchTexture
Expand Down Expand Up @@ -102,7 +103,7 @@ def width(self) -> int:
def height(self) -> int:
return self._size[1]

def clear(self, color: arcade.Color = (0, 0, 0, 0)):
def clear(self, color: arcade.Color = TRANSPARENT_BLACK):
"""Clear the surface"""
self.fbo.clear(color=color)

Expand Down
5 changes: 3 additions & 2 deletions arcade/gui/widgets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import arcade
from arcade import Sprite, get_window, Texture
from arcade.color import TRANSPARENT_BLACK
from arcade.gui.events import (
UIEvent,
UIMouseMovementEvent,
Expand Down Expand Up @@ -829,7 +830,7 @@ def on_update(self, dt):

def do_render(self, surface: Surface):
self.prepare_render(surface)
surface.clear(color=(0, 0, 0, 0))
surface.clear(color=TRANSPARENT_BLACK)
surface.draw_sprite(0, 0, self.width, self.height, self._sprite)


Expand Down Expand Up @@ -887,7 +888,7 @@ def __init__(
y=0,
width=100,
height=100,
color=(0, 0, 0, 0),
color=TRANSPARENT_BLACK,
size_hint=None,
size_hint_min=None,
size_hint_max=None,
Expand Down
9 changes: 5 additions & 4 deletions arcade/texture.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
calculate_hit_box_points_simple,
calculate_hit_box_points_detailed,
)
from arcade.color import TRANSPARENT_BLACK
from arcade.resources import resolve_resource_path
from arcade.cache.hit_box import HitBoxCache
from arcade.cache.image import WeakImageCache
Expand Down Expand Up @@ -206,7 +207,7 @@ def create_empty(cls, name: str, size: Tuple[int, int]) -> "Texture":
"""
return Texture(
name,
image=PIL.Image.new("RGBA", size, (0, 0, 0, 0)),
image=PIL.Image.new("RGBA", size, TRANSPARENT_BLACK),
hit_box_algorithm=None,
)

Expand Down Expand Up @@ -707,7 +708,7 @@ def make_circle_texture(diameter: int, color: Color, name: Optional[str] = None)
"circle_texture", diameter, color[0], color[1], color[2]
)

bg_color = (0, 0, 0, 0) # fully transparent
bg_color = TRANSPARENT_BLACK # fully transparent
img = PIL.Image.new("RGBA", (diameter, diameter), bg_color)
draw = PIL.ImageDraw.Draw(img)
draw.ellipse((0, 0, diameter - 1, diameter - 1), fill=color)
Expand Down Expand Up @@ -745,7 +746,7 @@ def make_soft_circle_texture(
outer_alpha,
) # name must be unique for caching

bg_color = (0, 0, 0, 0) # fully transparent
bg_color = TRANSPARENT_BLACK
img = PIL.Image.new("RGBA", (diameter, diameter), bg_color)
draw = PIL.ImageDraw.Draw(img)
max_radius = int(diameter // 2)
Expand Down Expand Up @@ -789,7 +790,7 @@ def make_soft_square_texture(
"gradientsquare", size, color, center_alpha, outer_alpha
)

bg_color = (0, 0, 0, 0) # fully transparent
bg_color = TRANSPARENT_BLACK
img = PIL.Image.new("RGBA", (size, size), bg_color)
draw = PIL.ImageDraw.Draw(img)
half_size = int(size // 2)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
def test_colors():
from arcade import color
names = color.__dict__.keys()
assert 1012 == len(names)
assert 1013 == len(names)