diff --git a/.gitignore b/.gitignore index 4e9d4dd..5a75048 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ notebooks/color_spaces_manyview.ipynb notebooks/oklch_srgb_spherical.ipynb notebooks/v1.4.0/ notebooks/v1.5.1/ +CHECKLIST.md diff --git a/README.md b/README.md index 2bafc70..a192700 100644 --- a/README.md +++ b/README.md @@ -30,13 +30,13 @@ both of which have fixed hue values and vary from 10% to 98% lightness. Monotone curves have fixed chroma, whereas the accent curves' chroma varies smoothly as a function of lightness within sRGB gamut bounds. -| Chroma curves | Color trajectories | -|-------------------------------------------------------|------------------------------------------| -| ![Chroma curves](images/curves/cstar-curves-v151.png) | ![Trajectories](images/trajectories.gif) | +| Chroma curves | Color trajectories | +|----------------------------------------------------------|------------------------------------------| +| ![Chroma curves](images/release/1.5.1/chroma-curves.png) | ![Trajectories](images/trajectories.gif) | -| Palette | -|--------------------------------| -| ![Palette](images/palette.png) | +| Palette | +|----------------------------------------------| +| ![Palette](images/release/1.5.1/palette.png) | Chroma curves are designed specifically to establish a distinct role for each accent and are non-intersecting over the lightness domain (hence the distinct diff --git a/images/release/1.5.1/chroma-bounds.png b/images/release/1.5.1/chroma-bounds.png new file mode 100644 index 0000000..c85b9bc Binary files /dev/null and b/images/release/1.5.1/chroma-bounds.png differ diff --git a/images/release/1.5.1/chroma-curves.png b/images/release/1.5.1/chroma-curves.png new file mode 100644 index 0000000..4c0d268 Binary files /dev/null and b/images/release/1.5.1/chroma-curves.png differ diff --git a/images/release/1.5.1/palette-bare.png b/images/release/1.5.1/palette-bare.png new file mode 100644 index 0000000..6e046df Binary files /dev/null and b/images/release/1.5.1/palette-bare.png differ diff --git a/images/release/1.5.1/palette.png b/images/release/1.5.1/palette.png new file mode 100644 index 0000000..a95e3d8 Binary files /dev/null and b/images/release/1.5.1/palette.png differ diff --git a/monobiome/plotting.py b/monobiome/plotting.py index 39b0695..e818618 100644 --- a/monobiome/plotting.py +++ b/monobiome/plotting.py @@ -1,9 +1,10 @@ +from importlib.metadata import version + import numpy as np import matplotlib.pyplot as plt from coloraide import Color from matplotlib.collections import LineCollection -from importlib.metadata import version from monobiome.palette import compute_hlc_map from monobiome.constants import ( h_map, @@ -11,13 +12,14 @@ from monobiome.constants import ( L_points, accent_h_map, monotone_h_map, - max_Cstar_Horder, Lspace_Cmax_Hmap, + max_Cstar_Horder, Lpoints_Cstar_Hmap, ) +VERSION = version("monobiome") -def plot_hue_chroma_bounds() -> None: +def plot_hue_chroma_bounds() -> tuple[plt.Figure, plt.Axes]: name_h_map = {} ax_h_map = {} fig, axes = plt.subplots( @@ -66,11 +68,12 @@ def plot_hue_chroma_bounds() -> None: ncol=3 ) - plt.suptitle("$C^*$ curves for hue groups") - plt.show() + plt.suptitle(f"$C^*$ curves for hue groups (v{VERSION})") + + return fig, axes -def plot_hue_chroma_star() -> None: +def plot_hue_chroma_star() -> tuple[plt.Figure, plt.Axes]: fig, ax = plt.subplots(1, 1, figsize=(8, 6)) # uncomment to preview 5 core term colors @@ -119,9 +122,9 @@ def plot_hue_chroma_star() -> None: ax.set_xlabel("Lightness (%)") ax.set_xticks([L_points[0], 45, 50, 55, 60, 65, 70, L_points[-1]]) - mb_version = version("monobiome") - plt.suptitle(f"$C^*$ curves (v{mb_version})") - fig.show() + plt.suptitle(f"$C^*$ curves (v{VERSION})") + + return fig, ax def palette_image( diff --git a/scripts/plots.py b/scripts/plots.py new file mode 100644 index 0000000..dceddb4 --- /dev/null +++ b/scripts/plots.py @@ -0,0 +1,24 @@ +from pathlib import Path + +import monobiome as mb +from monobiome import plotting +from monobiome.palette import compute_hlc_map + +figure_dir = Path(f"images/release/{mb.__version__}") +figure_dir.mkdir(parents=True, exist_ok=True) + +fig, ax = plotting.plot_hue_chroma_bounds() +fig.savefig(Path(figure_dir, "chroma-bounds.png")) + +fig, ax = plotting.plot_hue_chroma_star() +fig.savefig(Path(figure_dir, "chroma-curves.png")) + +# compute the palette as hex to ensure the rendering matches; using +# "oklch" causes some slight hex drift when later using an eyedropper +hlc_map = compute_hlc_map("hex") # ("oklch") + +fig, ax = plotting.show_palette(hlc_map) +fig.savefig(Path(figure_dir, "palette.png")) + +fig, ax = plotting.show_palette(hlc_map, show_labels=False) +fig.savefig(Path(figure_dir, "palette-bare.png"), pad_inches=0)