|
@@ -10,7 +10,7 @@ logging.basicConfig(level=logging.INFO) # Set loglevel to INFO or higher to prev
|
|
|
"""
|
|
"""
|
|
|
Helper functions
|
|
Helper functions
|
|
|
"""
|
|
"""
|
|
|
-# Return some colour
|
|
|
|
|
|
|
+# Return some hex 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
|
|
@@ -29,6 +29,9 @@ def generate_random_colour(sort:str="hex"):
|
|
|
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":
|
|
if sort.lower() == "rgb":
|
|
|
return rgb_values
|
|
return rgb_values
|
|
|
|
|
+
|
|
|
|
|
+ if sort.lower() == "ansi":
|
|
|
|
|
+ return print(f"\033[38;2;{rgb_values[0]};{rgb_values[1]};{rgb_values[2]}m")
|
|
|
|
|
|
|
|
# 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
|