Skip to content

Instantly share code, notes, and snippets.

@JosephTLyons
Created February 9, 2022 03:43
Show Gist options
  • Save JosephTLyons/931f8e26f7c70d8fece5628687726b15 to your computer and use it in GitHub Desktop.
Save JosephTLyons/931f8e26f7c70d8fece5628687726b15 to your computer and use it in GitHub Desktop.
def get_color_for_text(text):
colors = [
"black",
"blue",
"green",
"orange",
"red",
"silver",
"white",
"yellow",
]
return colors[hash(text) % len(colors)]
variable_names = [
"is_even",
"is_outlier",
"job",
"process_variable",
"threshold",
]
for variable_name in variable_names:
print(f"{variable_name}: {get_color_for_text(variable_name)}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment