|
@@ -10,7 +10,7 @@ logging.basicConfig(level=logging.INFO) # Set loglevel to INFO or higher to prev
|
|
|
"""
|
|
"""
|
|
|
Helper functions
|
|
Helper functions
|
|
|
"""
|
|
"""
|
|
|
-# Return some hex colour
|
|
|
|
|
|
|
+# Return some colour
|
|
|
"""
|
|
"""
|
|
|
Waiting for Stanford to fix a bug in the environment
|
|
Waiting for Stanford to fix a bug in the environment
|
|
|
CIP bug: https://codeinplace.stanford.edu/cip6/report?post=ac7c4ffd-1f90-475a-b4ee-2e5b73c5348f
|
|
CIP bug: https://codeinplace.stanford.edu/cip6/report?post=ac7c4ffd-1f90-475a-b4ee-2e5b73c5348f
|
|
@@ -24,9 +24,11 @@ def get_random_colour():
|
|
|
colour = colors.rgb2hex((get_random_colour()))
|
|
colour = colors.rgb2hex((get_random_colour()))
|
|
|
background = colors.rgb2hex((get_random_colour()))
|
|
background = colors.rgb2hex((get_random_colour()))
|
|
|
"""
|
|
"""
|
|
|
-def generate_random_colour():
|
|
|
|
|
|
|
+def generate_random_colour(sort:str="hex"):
|
|
|
# Generate random RGB values
|
|
# Generate random RGB values
|
|
|
rgb_values = [random.randrange(256), random.randrange(256), random.randrange(256)]
|
|
rgb_values = [random.randrange(256), random.randrange(256), random.randrange(256)]
|
|
|
|
|
+ if sort.lower() == "rgb":
|
|
|
|
|
+ return rgb_values
|
|
|
|
|
|
|
|
# Convert to HEX values
|
|
# Convert to HEX values
|
|
|
hex_colours = [hex(value)[2:] for value in rgb_values] # Strip the '0x' prefix
|
|
hex_colours = [hex(value)[2:] for value in rgb_values] # Strip the '0x' prefix
|