Created
September 18, 2023 18:57
-
-
Save wenijinew/929fc8e5cc51170a578523b8e2497c60 to your computer and use it in GitHub Desktop.
Generate arbitray Nadic Colors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generate_xadic_colors(hex_color, n_colors=7, plot=False, verbose=False): | |
""" "Convert.""" | |
hls_color = hex2hls(hex_color) | |
triadic_colors = [] | |
for offset in range(0, 360, 360 // n_colors): | |
triadic_colors.append( | |
((hls_color[0] + offset / 360) % 1.0, hls_color[1], hls_color[2]) | |
) | |
_colors = [hls2hex(hls_color) for hls_color in triadic_colors][0:n_colors] | |
if verbose: | |
logger.info(_colors) | |
if plot: | |
plt.figure(figsize=(18, 1)) | |
for i, color in enumerate(_colors): | |
plt.bar(i, 10, 0.8, color=color) | |
plt.show() | |
return _colors |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment