# Path: magical/style.py
# COLOURS_RGB = {
#     # I'm using Berkeley-branded versions of RGBY from
#     # https://brand.berkeley.edu/colors/ (lightened).
#     'blue': lighten_rgb(rgb(0x3B, 0x7E, 0xA1), 1.7),  # founder's rock
#     'yellow': lighten_rgb(rgb(0xFD, 0xB5, 0x15), 1.7),  # california gold
#     'red': lighten_rgb(rgb(0xEE, 0x1F, 0x60), 1.7),  # rose garden
#     'green': lighten_rgb(rgb(0x85, 0x94, 0x38), 1.7),  # soybean
#     'grey': rgb(162, 163, 175),  # cool grey (not sure which one)
#     'brown': rgb(224, 171, 118),  # buff
# }
# 
# GOAL_LINE_THICKNESS = 0.01
# 
# ROBOT_LINE_THICKNESS = 0.01
# 
# SHAPE_LINE_THICKNESS = 0.015
# 
# def darken_rgb(rgb):
#     """Produce a darker version of a base colour."""
#     h, l, s = colorsys.rgb_to_hls(*rgb)
#     hls_new = (h, max(0, l * 0.9), s)
#     return colorsys.hls_to_rgb(*hls_new)
# 
# def lighten_rgb(rgb, times=1):
#     """Produce a lighter version of a given base colour."""
#     h, l, s = colorsys.rgb_to_hls(*rgb)
#     mult = 1.4**times
#     hls_new = (h, 1 - (1 - l) / mult, s)
#     return colorsys.hls_to_rgb(*hls_new)


import abc
import enum
import math
import weakref
import numpy as np
import pymunk as pm
import pymunk.autogeometry as autogeom
import magical.geom as gtools
import magical.gym_render as r
from magical.style import (
    COLOURS_RGB, GOAL_LINE_THICKNESS, ROBOT_LINE_THICKNESS,
    SHAPE_LINE_THICKNESS, darken_rgb, lighten_rgb)
        elif self.shape_type == ShapeType.STAR:
            star_short_verts = gtools.compute_star_verts(
                star_npoints, star_out_rad - SHAPE_LINE_THICKNESS,
                star_in_rad - SHAPE_LINE_THICKNESS)
            short_convex_parts = autogeom.convex_decomposition(
                star_short_verts + star_short_verts[:1], 0)
            geoms_inner = []
            for part in short_convex_parts:
                geoms_inner.append(r.make_polygon(part))
            geoms_outer = []
            for part in convex_parts:
                geoms_outer.append(r.make_polygon(part))
        elif self.shape_type == ShapeType.OCTAGON \
                or self.shape_type == ShapeType.HEXAGON \
                or self.shape_type == ShapeType.PENTAGON \
                or self.shape_type == ShapeType.TRIANGLE:
            apothem = gtools.regular_poly_side_length_to_apothem(
                num_sides, side_len)
            short_side_len = gtools.regular_poly_apothem_to_side_legnth(
                num_sides, apothem - SHAPE_LINE_THICKNESS)
            short_verts = gtools.compute_regular_poly_verts(
                num_sides, short_side_len)
            geoms_inner = [r.make_polygon(short_verts)]
            geoms_outer = [r.make_polygon(poly_verts)]
        else:
            raise NotImplementedError("haven't implemented", self.shape_type)

        for g in geoms_inner:
            g.set_color(*self.colour)
        for g in geoms_outer:

# Path: magical/style.py
# COLOURS_RGB = {
#     # I'm using Berkeley-branded versions of RGBY from
#     # https://brand.berkeley.edu/colors/ (lightened).
#     'blue': lighten_rgb(rgb(0x3B, 0x7E, 0xA1), 1.7),  # founder's rock
#     'yellow': lighten_rgb(rgb(0xFD, 0xB5, 0x15), 1.7),  # california gold
#     'red': lighten_rgb(rgb(0xEE, 0x1F, 0x60), 1.7),  # rose garden
#     'green': lighten_rgb(rgb(0x85, 0x94, 0x38), 1.7),  # soybean
#     'grey': rgb(162, 163, 175),  # cool grey (not sure which one)
#     'brown': rgb(224, 171, 118),  # buff
# }
# 
# GOAL_LINE_THICKNESS = 0.01
# 
# ROBOT_LINE_THICKNESS = 0.01
# 
# SHAPE_LINE_THICKNESS = 0.015
# 
# def darken_rgb(rgb):
#     """Produce a darker version of a base colour."""
#     h, l, s = colorsys.rgb_to_hls(*rgb)
#     hls_new = (h, max(0, l * 0.9), s)
#     return colorsys.hls_to_rgb(*hls_new)
# 
# def lighten_rgb(rgb, times=1):
#     """Produce a lighter version of a given base colour."""
#     h, l, s = colorsys.rgb_to_hls(*rgb)
#     mult = 1.4**times
#     hls_new = (h, 1 - (1 - l) / mult, s)
#     return colorsys.hls_to_rgb(*hls_new)


# Path: magical/entities.py
import abc
import enum
import math
import weakref
import numpy as np
import pymunk as pm
import pymunk.autogeometry as autogeom
import magical.geom as gtools
import magical.gym_render as r
from magical.style import (
    COLOURS_RGB, GOAL_LINE_THICKNESS, ROBOT_LINE_THICKNESS,
    SHAPE_LINE_THICKNESS, darken_rgb, lighten_rgb)

        elif self.shape_type == ShapeType.STAR:
            star_short_verts = gtools.compute_star_verts(
                star_npoints, star_out_rad - SHAPE_LINE_THICKNESS,
                star_in_rad - SHAPE_LINE_THICKNESS)
            short_convex_parts = autogeom.convex_decomposition(
                star_short_verts + star_short_verts[:1], 0)
            geoms_inner = []
            for part in short_convex_parts:
                geoms_inner.append(r.make_polygon(part))
            geoms_outer = []
            for part in convex_parts:
                geoms_outer.append(r.make_polygon(part))
        elif self.shape_type == ShapeType.OCTAGON \
                or self.shape_type == ShapeType.HEXAGON \
                or self.shape_type == ShapeType.PENTAGON \
                or self.shape_type == ShapeType.TRIANGLE:
            apothem = gtools.regular_poly_side_length_to_apothem(
                num_sides, side_len)
            short_side_len = gtools.regular_poly_apothem_to_side_legnth(
                num_sides, apothem - SHAPE_LINE_THICKNESS)
            short_verts = gtools.compute_regular_poly_verts(
                num_sides, short_side_len)
            geoms_inner = [r.make_polygon(short_verts)]
            geoms_outer = [r.make_polygon(poly_verts)]
        else:
            raise NotImplementedError("haven't implemented", self.shape_type)

        for g in geoms_inner:
            g.set_color(*self.colour)
        for g in geoms_outer:

            g.set_color(*darken_rgb(self.colour))