luna.util package

Submodules

Module contents

class ColorPallete(color_map=None, default_color=(255, 255, 255))[source]

Bases: object

add_color(key, color)[source]
get_color(key)[source]
get_normalized_color(key)[source]
get_unnormalized_color(key)[source]
func_call_to_str(func, *args, **kwargs)[source]
hex2rgb(hexcode)[source]
iter_to_chunks(l, n)[source]
new_random_string(size=32, chars='ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')[source]

Generate a new random string of size size containing only the characters provided in chars.

Parameters
  • size (int, optional) – The size of the new string. The default value is 32.

  • chars (iterable, optional) – A sequence of characters to choose from. The default value is ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789’.

Returns

random_string – The new random string.

Return type

str

rgb2hex(r, g, b)[source]