import json import sys # hacky way to import utils for now sys.path.append("..") from utils import rgb_to_hex corner_shape = [ # giving all 4 corners have the same shape [0, 0, 0, 0], [0, 1, 1, 0], [0, 1, 1, 0], [0, 0, 0, 0], ] center_color = [0, 0, 0] corner_colors = { # assuming each corner will only have two colors (center_color and a corner-specific color) 0: [255, 0, 0], 1: [0, 255, 0], 2: [0, 0, 255], 3: [255, 255, 255,] } center_color = rgb_to_hex(center_color) corner_colors = {key: rgb_to_hex(val) for key, val in corner_colors.items()} corner_colored_shapes = { corner_ind: [[corner_color if cell else center_color for cell in row] for row in corner_shape] for corner_ind, corner_color in corner_colors.items() } with open("corners_hollow4x4_v0.json", "w") as f: json.dump({ "corner_colors": corner_colored_shapes, "corner_width": len(corner_shape[0]), "corner_height": len(corner_shape), }, f)