Skip to content

Commit 23195b9

Browse files
committed
match RTD background
1 parent add8ab1 commit 23195b9

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

docs/logo_animated.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
def add_rounded_corners(size, rad):
1313
# Make new images
14-
circle = Image.new("L", (rad * 2, rad * 2), 1)
14+
circle = Image.new("L", (rad * 2, rad * 2), color=1)
1515
draw = ImageDraw.Draw(circle)
1616
draw.ellipse((0, 0, rad * 2, rad * 2), fill=0)
1717
alpha = Image.new("L", size, 0)
@@ -24,8 +24,12 @@ def add_rounded_corners(size, rad):
2424
alpha.paste(circle.crop((rad, rad, rad * 2, rad * 2)), (w - rad, h - rad))
2525

2626
# To array
27-
cut = np.array(alpha).astype(float)
28-
cut[cut == 0] = np.nan
27+
cut = np.array(alpha)
28+
cut = cut.reshape((*cut.shape, 1)).repeat(4, axis=2)
29+
30+
# Set the corners to (252, 252, 252, 255) to match the RTD background #FCFCFC
31+
cut[:, :, -1] *= 255
32+
cut[:, :, :-1] *= 252
2933
return cut
3034

3135

@@ -49,9 +53,7 @@ def get_new_artists(npoints, learner, data, rounded_corners, ax):
4953
line1, line2 = plot_tri(new_learner, ax)
5054
data = np.rot90(new_learner.interpolated_on_grid()[-1])
5155
im = ax.imshow(data, extent=(-0.5, 0.5, -0.5, 0.5), cmap="viridis")
52-
im2 = ax.imshow(
53-
rounded_corners, extent=(-0.5, 0.5, -0.5, 0.5), cmap="gray_r", zorder=10
54-
)
56+
im2 = ax.imshow(rounded_corners, extent=(-0.5, 0.5, -0.5, 0.5), zorder=10)
5557
return im, line1, line2, im2
5658

5759

0 commit comments

Comments
 (0)