monobiome 1.5.1__tar.gz → 1.5.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {monobiome-1.5.1 → monobiome-1.5.4}/PKG-INFO +10 -3
  2. {monobiome-1.5.1 → monobiome-1.5.4}/README.md +9 -2
  3. {monobiome-1.5.1 → monobiome-1.5.4}/monobiome/palette.py +6 -2
  4. {monobiome-1.5.1 → monobiome-1.5.4}/monobiome/plotting.py +7 -5
  5. {monobiome-1.5.1 → monobiome-1.5.4}/monobiome/util.py +11 -0
  6. {monobiome-1.5.1 → monobiome-1.5.4}/monobiome.egg-info/PKG-INFO +10 -3
  7. {monobiome-1.5.1 → monobiome-1.5.4}/pyproject.toml +1 -1
  8. {monobiome-1.5.1 → monobiome-1.5.4}/monobiome/__init__.py +0 -0
  9. {monobiome-1.5.1 → monobiome-1.5.4}/monobiome/__main__.py +0 -0
  10. {monobiome-1.5.1 → monobiome-1.5.4}/monobiome/cli/__init__.py +0 -0
  11. {monobiome-1.5.1 → monobiome-1.5.4}/monobiome/cli/fill.py +0 -0
  12. {monobiome-1.5.1 → monobiome-1.5.4}/monobiome/cli/palette.py +0 -0
  13. {monobiome-1.5.1 → monobiome-1.5.4}/monobiome/cli/scheme.py +0 -0
  14. {monobiome-1.5.1 → monobiome-1.5.4}/monobiome/constants.py +0 -0
  15. {monobiome-1.5.1 → monobiome-1.5.4}/monobiome/curve.py +0 -0
  16. {monobiome-1.5.1 → monobiome-1.5.4}/monobiome/data/parameters.toml +0 -0
  17. {monobiome-1.5.1 → monobiome-1.5.4}/monobiome/scheme.py +0 -0
  18. {monobiome-1.5.1 → monobiome-1.5.4}/monobiome.egg-info/SOURCES.txt +0 -0
  19. {monobiome-1.5.1 → monobiome-1.5.4}/monobiome.egg-info/dependency_links.txt +0 -0
  20. {monobiome-1.5.1 → monobiome-1.5.4}/monobiome.egg-info/entry_points.txt +0 -0
  21. {monobiome-1.5.1 → monobiome-1.5.4}/monobiome.egg-info/requires.txt +0 -0
  22. {monobiome-1.5.1 → monobiome-1.5.4}/monobiome.egg-info/top_level.txt +0 -0
  23. {monobiome-1.5.1 → monobiome-1.5.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: monobiome
3
- Version: 1.5.1
3
+ Version: 1.5.4
4
4
  Summary: Monobiome color palette
5
5
  Author-email: Sam Griesemer <git@olog.io>
6
6
  License-Expression: MIT
@@ -72,11 +72,11 @@ smoothly as a function of lightness within sRGB gamut bounds.
72
72
 
73
73
  | Chroma curves | Color trajectories |
74
74
  |----------------------------------------------------------|------------------------------------------|
75
- | ![Chroma curves](images/release/1.5.1/chroma-curves.png) | ![Trajectories](images/trajectories.gif) |
75
+ | ![Chroma curves](images/release/1.5.4/chroma-curves.png) | ![Trajectories](images/trajectories.gif) |
76
76
 
77
77
  | Palette |
78
78
  |----------------------------------------------|
79
- | ![Palette](images/release/1.5.1/palette.png) |
79
+ | ![Palette](images/release/1.5.4/palette.png) |
80
80
 
81
81
  Chroma curves are designed specifically to establish a distinct role for each
82
82
  accent and are non-intersecting over the lightness domain (hence the distinct
@@ -183,6 +183,13 @@ using the `monobiome` CLI:
183
183
  (`grassland`). Every part of this process can be customized: the scheme
184
184
  parameters, the scheme definitions/file, the app template.
185
185
 
186
+ The separation of duties here facilitates robustness: the palette colors can be
187
+ tweaked (across versions, say) without changing how those colors get used in
188
+ app themes. Scheme files don't hardcode color values, and app templates don't
189
+ refer to palette variables at all. Scheme files bridge palette colors with
190
+ *intended uses*, and templates need only align those uses under an app's
191
+ expected config syntax.
192
+
186
193
  Running these commands in sequence from the repo root should work
187
194
  out-of-the-box after having installed the CLI tool.
188
195
 
@@ -32,11 +32,11 @@ smoothly as a function of lightness within sRGB gamut bounds.
32
32
 
33
33
  | Chroma curves | Color trajectories |
34
34
  |----------------------------------------------------------|------------------------------------------|
35
- | ![Chroma curves](images/release/1.5.1/chroma-curves.png) | ![Trajectories](images/trajectories.gif) |
35
+ | ![Chroma curves](images/release/1.5.4/chroma-curves.png) | ![Trajectories](images/trajectories.gif) |
36
36
 
37
37
  | Palette |
38
38
  |----------------------------------------------|
39
- | ![Palette](images/release/1.5.1/palette.png) |
39
+ | ![Palette](images/release/1.5.4/palette.png) |
40
40
 
41
41
  Chroma curves are designed specifically to establish a distinct role for each
42
42
  accent and are non-intersecting over the lightness domain (hence the distinct
@@ -143,6 +143,13 @@ using the `monobiome` CLI:
143
143
  (`grassland`). Every part of this process can be customized: the scheme
144
144
  parameters, the scheme definitions/file, the app template.
145
145
 
146
+ The separation of duties here facilitates robustness: the palette colors can be
147
+ tweaked (across versions, say) without changing how those colors get used in
148
+ app themes. Scheme files don't hardcode color values, and app templates don't
149
+ refer to palette variables at all. Scheme files bridge palette colors with
150
+ *intended uses*, and templates need only align those uses under an app's
151
+ expected config syntax.
152
+
146
153
  Running these commands in sequence from the repo root should work
147
154
  out-of-the-box after having installed the CLI tool.
148
155
 
@@ -5,6 +5,10 @@ from importlib.metadata import version
5
5
 
6
6
  from coloraide import Color
7
7
 
8
+ from monobiome.util import (
9
+ hex_from_rgb8,
10
+ srgb8_from_color,
11
+ )
8
12
  from monobiome.constants import (
9
13
  h_map,
10
14
  L_points,
@@ -24,8 +28,8 @@ def compute_hlc_map(notation: str) -> dict[str, Any]:
24
28
  oklch = Color('oklch', [_l/100, _c, _h])
25
29
 
26
30
  if notation == "hex":
27
- srgb = oklch.convert('srgb')
28
- c_str = srgb.to_string(hex=True)
31
+ rgb8 = srgb8_from_color(oklch)
32
+ c_str = hex_from_rgb8(rgb8)
29
33
  elif notation == "oklch":
30
34
  ol, oc, oh = oklch.convert('oklch').coords()
31
35
  c_str = f"oklch({ol*100:.1f}% {oc:.4f} {oh:.1f})"
@@ -5,6 +5,7 @@ import matplotlib.pyplot as plt
5
5
  from coloraide import Color
6
6
  from matplotlib.collections import LineCollection
7
7
 
8
+ from monobiome.util import srgb8_from_color
8
9
  from monobiome.palette import compute_hlc_map
9
10
  from monobiome.constants import (
10
11
  h_map,
@@ -87,7 +88,9 @@ def plot_hue_chroma_star() -> tuple[plt.Figure, plt.Axes]:
87
88
 
88
89
  _h = h_map[h_str]
89
90
  h_colors = [
90
- Color('oklch', [_l/100, _c, _h]).convert("srgb")
91
+ Color(
92
+ 'oklch', [_l/100, _c, _h]
93
+ ).convert("srgb").fit(method="oklch-chroma")
91
94
  for _l, _c in zip(L_points, Lpoints_Cstar, strict=True)
92
95
  ]
93
96
 
@@ -124,7 +127,7 @@ def palette_image(
124
127
 
125
128
  h = row_count * cell_size
126
129
  w = max_cols * cell_size
127
- img = np.ones((h, w, 3), float)
130
+ img = np.ones((h, w, 3), int)
128
131
 
129
132
  lightness_keys_per_row = []
130
133
 
@@ -133,8 +136,7 @@ def palette_image(
133
136
  lkeys = sorted(shades.keys())
134
137
  lightness_keys_per_row.append(lkeys)
135
138
  for c, k in enumerate(lkeys):
136
- col = Color(shades[k]).convert("srgb").fit(method="clip")
137
- rgb = [col["r"], col["g"], col["b"]]
139
+ rgb = srgb8_from_color(shades[k])
138
140
  r0, r1 = r * cell_size, (r + 1) * cell_size
139
141
  c0, c1 = c * cell_size, (c + 1) * cell_size
140
142
  img[r0:r1, c0:c1, :] = rgb
@@ -156,7 +158,7 @@ def show_palette(
156
158
  if show_labels:
157
159
  fig, ax = plt.subplots(figsize=(fig_w, fig_h), dpi=dpi)
158
160
 
159
- ax.imshow(img, interpolation="none", origin="upper")
161
+ ax.imshow(img, interpolation="nearest", origin="upper")
160
162
  ax.set_xticks([])
161
163
 
162
164
  ytick_pos = [(i + 0.5) * cell_size for i in range(len(names))]
@@ -2,6 +2,7 @@ import math
2
2
  from types import GenericAlias
3
3
  from argparse import ArgumentParser, _SubParsersAction
4
4
 
5
+ import numpy as np
5
6
  from coloraide import Color
6
7
 
7
8
  _SubParsersAction.__class_getitem__ = classmethod(GenericAlias)
@@ -33,3 +34,13 @@ def oklch_distance(xc: Color, yc: Color) -> float:
33
34
  dz = l1 - l2
34
35
 
35
36
  return (dx**2 + dy**2 + dz**2)**0.5
37
+
38
+ def srgb8_from_color(c: str | Color) -> np.ndarray:
39
+ c = Color(c).convert("srgb").fit(method="oklch-chroma")
40
+ rgb = np.array([c["r"], c["g"], c["b"]], dtype=float)
41
+ rgb8 = np.clip(np.round(rgb * 255), 0, 255).astype(np.uint8)
42
+
43
+ return rgb8
44
+
45
+ def hex_from_rgb8(rgb8: np.ndarray) -> str:
46
+ return f"#{int(rgb8[0]):02x}{int(rgb8[1]):02x}{int(rgb8[2]):02x}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: monobiome
3
- Version: 1.5.1
3
+ Version: 1.5.4
4
4
  Summary: Monobiome color palette
5
5
  Author-email: Sam Griesemer <git@olog.io>
6
6
  License-Expression: MIT
@@ -72,11 +72,11 @@ smoothly as a function of lightness within sRGB gamut bounds.
72
72
 
73
73
  | Chroma curves | Color trajectories |
74
74
  |----------------------------------------------------------|------------------------------------------|
75
- | ![Chroma curves](images/release/1.5.1/chroma-curves.png) | ![Trajectories](images/trajectories.gif) |
75
+ | ![Chroma curves](images/release/1.5.4/chroma-curves.png) | ![Trajectories](images/trajectories.gif) |
76
76
 
77
77
  | Palette |
78
78
  |----------------------------------------------|
79
- | ![Palette](images/release/1.5.1/palette.png) |
79
+ | ![Palette](images/release/1.5.4/palette.png) |
80
80
 
81
81
  Chroma curves are designed specifically to establish a distinct role for each
82
82
  accent and are non-intersecting over the lightness domain (hence the distinct
@@ -183,6 +183,13 @@ using the `monobiome` CLI:
183
183
  (`grassland`). Every part of this process can be customized: the scheme
184
184
  parameters, the scheme definitions/file, the app template.
185
185
 
186
+ The separation of duties here facilitates robustness: the palette colors can be
187
+ tweaked (across versions, say) without changing how those colors get used in
188
+ app themes. Scheme files don't hardcode color values, and app templates don't
189
+ refer to palette variables at all. Scheme files bridge palette colors with
190
+ *intended uses*, and templates need only align those uses under an app's
191
+ expected config syntax.
192
+
186
193
  Running these commands in sequence from the repo root should work
187
194
  out-of-the-box after having installed the CLI tool.
188
195
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "monobiome"
7
- version = "1.5.1"
7
+ version = "1.5.4"
8
8
  description = "Monobiome color palette"
9
9
  requires-python = ">=3.12"
10
10
  authors = [
File without changes
File without changes
File without changes