INNER CODE UNIT · Python
fstate
ljvmiranda921/sprites-as-a-service · backend/sprites/sprites.py:70
fstate = sim.get_history()[-1]
logger.debug("Adding outline, gradient, and colors")
sprite = np.hstack([fstate, np.fliplr(fstate)])
sprite = np.pad(sprite, mode="constant", pad_width=1, constant_values=1)
sprite_with_outline = _add_outline(sprite)
sprite_gradient = _get_gradient(sprite_with_outline)
sprite_final = _combine(sprite_with_outline, sprite_gradient)
logger.trace("Registering a colormap")
iterator = list(_group(3, color_seeds))[:3] if color_seeds else [None] * 3
random_colors = [_color(seeds) for seeds in iterator]
base_colors = ["black", "#f2f2f2"]
colors = base_colors + random_colors
logger.trace(f"Colors to use: {colors}")
cm.register_cmap(
cmap=mpl.colors.LinearSegmentedColormap.from_list(
"custom", colors