monobiome 1.5.1__py3-none-any.whl → 1.5.4__py3-none-any.whl
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.
- monobiome/palette.py +6 -2
- monobiome/plotting.py +7 -5
- monobiome/util.py +11 -0
- {monobiome-1.5.1.dist-info → monobiome-1.5.4.dist-info}/METADATA +10 -3
- {monobiome-1.5.1.dist-info → monobiome-1.5.4.dist-info}/RECORD +8 -8
- {monobiome-1.5.1.dist-info → monobiome-1.5.4.dist-info}/WHEEL +1 -1
- {monobiome-1.5.1.dist-info → monobiome-1.5.4.dist-info}/entry_points.txt +0 -0
- {monobiome-1.5.1.dist-info → monobiome-1.5.4.dist-info}/top_level.txt +0 -0
monobiome/palette.py
CHANGED
|
@@ -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
|
-
|
|
28
|
-
c_str =
|
|
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})"
|
monobiome/plotting.py
CHANGED
|
@@ -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(
|
|
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),
|
|
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
|
-
|
|
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="
|
|
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))]
|
monobiome/util.py
CHANGED
|
@@ -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.
|
|
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
|
-
|  |  |
|
|
76
76
|
|
|
77
77
|
| Palette |
|
|
78
78
|
|----------------------------------------------|
|
|
79
|
-
|  |
|
|
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
|
|
|
@@ -2,17 +2,17 @@ monobiome/__init__.py,sha256=ChC5YFLK0kgvi0MJwD68LtZgUMJVCtNbtY32UQTvdA4,75
|
|
|
2
2
|
monobiome/__main__.py,sha256=4K-CQWWiSXQbXgNLPqdOts6R3wOJeDJ0ygSARPI-eiA,439
|
|
3
3
|
monobiome/constants.py,sha256=zkIDBtPS3unt9EulnTfpJV8r82Cc1Q-8c7u2Y2jcgBY,3694
|
|
4
4
|
monobiome/curve.py,sha256=4IMn-YksJrqMOR-oYjA9oIJChI_Hz11AmynhYjLXl48,1754
|
|
5
|
-
monobiome/palette.py,sha256=
|
|
6
|
-
monobiome/plotting.py,sha256=
|
|
5
|
+
monobiome/palette.py,sha256=DdyJSc3ADRV2dw6--0mK2VWm5fz3nU3RBJ3hJTWzpFU,1574
|
|
6
|
+
monobiome/plotting.py,sha256=DN_sjDrnt5sAZWQ7bXzs-YDef3ieiuLVrp9xMTdojzE,6156
|
|
7
7
|
monobiome/scheme.py,sha256=5AwQW5Ibs-B7ZahGSXSmTE7CFZUpk3SKN42Qo-EW2AM,7793
|
|
8
|
-
monobiome/util.py,sha256=
|
|
8
|
+
monobiome/util.py,sha256=VDBTaJJuNaeb0N_8H5Wxr6VOPS8wxLzrtlDaOSqUVFE,1455
|
|
9
9
|
monobiome/cli/__init__.py,sha256=bs2ZJZSWNg5tuxzAMzRzyB25Lbc4PDCVbrF2IKl2lK8,819
|
|
10
10
|
monobiome/cli/fill.py,sha256=FbDpUZJegCUatFxPRk8hp4z2V93WBwqHPCOpw3rzJR4,2116
|
|
11
11
|
monobiome/cli/palette.py,sha256=X1QET3UU1RxzT8D0JLWL1JKNlSQ6Dulwl1J-GLc_218,1265
|
|
12
12
|
monobiome/cli/scheme.py,sha256=DNwA6Af3bJZpjImisncOgQo_kFHGTot-Ydv6o4FR1-Y,3769
|
|
13
13
|
monobiome/data/parameters.toml,sha256=7ru0j_1G5rNFWc7AFKSHJUpyL_I2qdZYeDFt6q5wtQw,801
|
|
14
|
-
monobiome-1.5.
|
|
15
|
-
monobiome-1.5.
|
|
16
|
-
monobiome-1.5.
|
|
17
|
-
monobiome-1.5.
|
|
18
|
-
monobiome-1.5.
|
|
14
|
+
monobiome-1.5.4.dist-info/METADATA,sha256=xBo5t153BavGyDxUqvJhly-SKFms1KPf-vRSOxbxNZQ,15204
|
|
15
|
+
monobiome-1.5.4.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
16
|
+
monobiome-1.5.4.dist-info/entry_points.txt,sha256=LpqkPxdTacTY_TaRn8eczICmPbVlXdRSoMqaxSfVxh4,54
|
|
17
|
+
monobiome-1.5.4.dist-info/top_level.txt,sha256=ZA2wgRkPoG4xG0rSjyHKkuG8cdSHRr1U_DcrplXoi3A,10
|
|
18
|
+
monobiome-1.5.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|