|
@ -3,9 +3,14 @@ from typing import List |
|
|
import matplotlib.colors as mcolors |
|
|
import matplotlib.colors as mcolors |
|
|
import matplotlib.pyplot as plt |
|
|
import matplotlib.pyplot as plt |
|
|
import numpy as np |
|
|
import numpy as np |
|
|
|
|
|
from matplotlib.font_manager import FontProperties |
|
|
|
|
|
|
|
|
|
|
|
pt_mono_font = FontProperties( |
|
|
|
|
|
fname="/usr/share/fonts/truetype/PT_Mono/PTMono-Regular.ttf" |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
# set font by default to courier new |
|
|
# set font by default to courier new |
|
|
plt.rcParams["font.family"] = "PT Mono" |
|
|
# plt.rcParams["font.family"] = "PT Mono" |
|
|
# # sort by the proximity to the colors in viridis |
|
|
# # sort by the proximity to the colors in viridis |
|
|
# # Importing necessary functions |
|
|
# # Importing necessary functions |
|
|
|
|
|
|
|
@ -63,6 +68,7 @@ def create_color_calibration_image( |
|
|
color.replace("xkcd:", ""), |
|
|
color.replace("xkcd:", ""), |
|
|
va="center", |
|
|
va="center", |
|
|
fontsize=fontsize, |
|
|
fontsize=fontsize, |
|
|
|
|
|
fontproperties=pt_mono_font, |
|
|
# bbox=dict(facecolor='gray', alpha=0.21), |
|
|
# bbox=dict(facecolor='gray', alpha=0.21), |
|
|
) |
|
|
) |
|
|
ax.text( |
|
|
ax.text( |
|
@ -71,6 +77,7 @@ def create_color_calibration_image( |
|
|
f"{hex_code}\n({rgb_triple})", |
|
|
f"{hex_code}\n({rgb_triple})", |
|
|
va="center", |
|
|
va="center", |
|
|
fontsize=6, |
|
|
fontsize=6, |
|
|
|
|
|
fontproperties=pt_mono_font, |
|
|
# bbox=dict(facecolor='gray', alpha=0.33), |
|
|
# bbox=dict(facecolor='gray', alpha=0.33), |
|
|
) |
|
|
) |
|
|
# ax.text( |
|
|
# ax.text( |
|
@ -79,6 +86,7 @@ def create_color_calibration_image( |
|
|
# f"{hex_code}", |
|
|
# f"{hex_code}", |
|
|
# va="center", |
|
|
# va="center", |
|
|
# fontsize=fontsize * 0.6, |
|
|
# fontsize=fontsize * 0.6, |
|
|
|
|
|
# fontproperties=pt_mono_font, |
|
|
# ) |
|
|
# ) |
|
|
|
|
|
|
|
|
# Draw color square |
|
|
# Draw color square |
|
@ -160,7 +168,7 @@ if __name__ == "__main__": |
|
|
"--rows", type=int, default=73, help="Number of entries per column" |
|
|
"--rows", type=int, default=73, help="Number of entries per column" |
|
|
) |
|
|
) |
|
|
parser.add_argument( |
|
|
parser.add_argument( |
|
|
"--dir", type=str, default="/Volumes/TMP/tests", help="Directory to save images" |
|
|
"--dir", type=str, default="~/color/out", help="Directory to save images" |
|
|
) |
|
|
) |
|
|
parser.add_argument( |
|
|
parser.add_argument( |
|
|
"-k", |
|
|
"-k", |
|
|