def dim_hsl(colour: libtcod.Color, amt: int) -> libtcod.Color: """ Dim a colour object by adjusting the L attribute of HSL representation :param colour: the colour that you want to adjust :param amt: the coefficient you want to adjust it by. 1.0 means unchanged :return: the new colour """ new_colour = copy.deepcopy(colour) libtcod.color_scale_HSV(new_colour, 1.0, amt) return new_colour
def test_color(): color_a = libtcodpy.Color(0, 1, 2) assert list(color_a) == [0, 1, 2] assert color_a[0] == color_a.r assert color_a[1] == color_a.g assert color_a[2] == color_a.b color_a[1] = 3 color_a['b'] = color_a['b'] assert list(color_a) == [0, 3, 2] assert color_a == color_a color_b = libtcodpy.Color(255, 255, 255) assert color_a != color_b color = libtcodpy.color_lerp(color_a, color_b, 0.5) libtcodpy.color_set_hsv(color, 0, 0, 0) libtcodpy.color_get_hsv(color) libtcodpy.color_scale_HSV(color, 0, 0)
green = tcod.Color(133, 153, 0) orange = tcod.Color(203, 75, 22) yellow = tcod.Color(181, 137, 0) base03 = tcod.Color(0, 43, 54) # background base02 = tcod.Color(7, 54, 66) base01 = tcod.Color(88, 110, 117) # "disabled" color base00 = tcod.Color(101, 123, 131) base0 = tcod.Color(131, 148, 150) base1 = tcod.Color(147, 161, 161) base2 = tcod.Color(238, 232, 213) base3 = tcod.Color(253, 246, 227) # Desaturated colors, used for items of the floor and stairs door_color = tcod.Color(203, 75, 22) tcod.color_scale_HSV(door_color, 0.7, 1) desat_orange = door_color desat_red = tcod.Color(220, 50, 47) tcod.color_scale_HSV(desat_red, 0.7, 1) desat_magenta = tcod.Color(211, 54, 130) tcod.color_scale_HSV(desat_magenta, 0.7, 1) desat_violet = tcod.Color(108, 113, 196) tcod.color_scale_HSV(desat_violet, 0.7, 1) desat_blue = tcod.Color(38, 139, 210) tcod.color_scale_HSV(desat_blue, 0.7, 1) desat_green = tcod.Color(133, 153, 0) tcod.color_scale_HSV(desat_green, 0.7, 1) desat_green2 = tcod.Color(133, 153, 0) tcod.color_scale_HSV(desat_green2, 0.7, 0.6) desat_yellow = tcod.Color(181, 137, 0)