monobiome 1.5.0__tar.gz → 1.5.3__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.0 → monobiome-1.5.3}/PKG-INFO +42 -34
  2. {monobiome-1.5.0 → monobiome-1.5.3}/README.md +41 -33
  3. {monobiome-1.5.0 → monobiome-1.5.3}/monobiome/cli/palette.py +3 -3
  4. {monobiome-1.5.0 → monobiome-1.5.3}/monobiome/cli/scheme.py +10 -10
  5. {monobiome-1.5.0 → monobiome-1.5.3}/monobiome/constants.py +18 -0
  6. {monobiome-1.5.0 → monobiome-1.5.3}/monobiome/palette.py +6 -2
  7. {monobiome-1.5.0 → monobiome-1.5.3}/monobiome/plotting.py +45 -30
  8. {monobiome-1.5.0 → monobiome-1.5.3}/monobiome/util.py +11 -0
  9. {monobiome-1.5.0 → monobiome-1.5.3}/monobiome.egg-info/PKG-INFO +42 -34
  10. {monobiome-1.5.0 → monobiome-1.5.3}/pyproject.toml +1 -1
  11. {monobiome-1.5.0 → monobiome-1.5.3}/monobiome/__init__.py +0 -0
  12. {monobiome-1.5.0 → monobiome-1.5.3}/monobiome/__main__.py +0 -0
  13. {monobiome-1.5.0 → monobiome-1.5.3}/monobiome/cli/__init__.py +0 -0
  14. {monobiome-1.5.0 → monobiome-1.5.3}/monobiome/cli/fill.py +0 -0
  15. {monobiome-1.5.0 → monobiome-1.5.3}/monobiome/curve.py +0 -0
  16. {monobiome-1.5.0 → monobiome-1.5.3}/monobiome/data/parameters.toml +0 -0
  17. {monobiome-1.5.0 → monobiome-1.5.3}/monobiome/scheme.py +0 -0
  18. {monobiome-1.5.0 → monobiome-1.5.3}/monobiome.egg-info/SOURCES.txt +0 -0
  19. {monobiome-1.5.0 → monobiome-1.5.3}/monobiome.egg-info/dependency_links.txt +0 -0
  20. {monobiome-1.5.0 → monobiome-1.5.3}/monobiome.egg-info/entry_points.txt +0 -0
  21. {monobiome-1.5.0 → monobiome-1.5.3}/monobiome.egg-info/requires.txt +0 -0
  22. {monobiome-1.5.0 → monobiome-1.5.3}/monobiome.egg-info/top_level.txt +0 -0
  23. {monobiome-1.5.0 → monobiome-1.5.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: monobiome
3
- Version: 1.5.0
3
+ Version: 1.5.3
4
4
  Summary: Monobiome color palette
5
5
  Author-email: Sam Griesemer <git@olog.io>
6
6
  License-Expression: MIT
@@ -70,13 +70,13 @@ both of which have fixed hue values and vary from 10% to 98% lightness.
70
70
  Monotone curves have fixed chroma, whereas the accent curves' chroma varies
71
71
  smoothly as a function of lightness within sRGB gamut bounds.
72
72
 
73
- | Chroma curves | Color trajectories |
74
- |---|---|
75
- | ![Chroma curves](images/curves/cstar-curves-v140.png) | ![Trajectories](images/trajectories.gif) |
73
+ | Chroma curves | Color trajectories |
74
+ |----------------------------------------------------------|------------------------------------------|
75
+ | ![Chroma curves](images/release/1.5.2/chroma-curves.png) | ![Trajectories](images/trajectories.gif) |
76
76
 
77
- | Palette |
78
- |---|
79
- | ![Palette](images/palette.png) |
77
+ | Palette |
78
+ |----------------------------------------------|
79
+ | ![Palette](images/release/1.5.2/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
@@ -100,8 +100,8 @@ varying only in lightness from dark to light grey.
100
100
 
101
101
  ## Themes
102
102
 
103
- | Dark themes | Light themes |
104
- |---|---|
103
+ | Dark themes | Light themes |
104
+ |----------------------------------------|------------------------------------------|
105
105
  | ![Dark themes](images/dark_themes.png) | ![Light themes](images/light_themes.png) |
106
106
 
107
107
  Themes are derived from the `monobiome` palette by selecting a monotone base
@@ -118,10 +118,10 @@ to the background.
118
118
  The following plots show the intersection of the sphere centered at a fixed
119
119
  background color (`alpine` biome with a lightness of 20) under variable radii:
120
120
 
121
- | | `-l 20 -d 0.3` | `-l 20 -d 0.4` | `-l 20 -d 0.5` |
122
- |---|---|---|---|
123
- | Color visualization | ![](images/oklch/mb_b20_d30.gif) | ![](images/oklch/mb_b20_d40.gif) | ![](images/oklch/mb_b20_d50.gif) |
124
- | Editor preview | ![](images/render/v140-demo-alpine-dark-d0.3.png) | ![](images/render/v140-demo-alpine-dark-d0.4.png) | ![](images/render/v140-demo-alpine-dark-d0.5.png) |
121
+ | | `-l 20 -d 0.3` | `-l 20 -d 0.4` | `-l 20 -d 0.5` |
122
+ |---------------------|---------------------------------------------------|---------------------------------------------------|---------------------------------------------------|
123
+ | Color visualization | ![](images/oklch/mb_b20_d30.gif) | ![](images/oklch/mb_b20_d40.gif) | ![](images/oklch/mb_b20_d50.gif) |
124
+ | Editor preview | ![](images/render/v140-demo-alpine-dark-d0.3.png) | ![](images/render/v140-demo-alpine-dark-d0.4.png) | ![](images/render/v140-demo-alpine-dark-d0.5.png) |
125
125
 
126
126
  In short, the base lightness (`-l`) dictates the brightness of the background,
127
127
  and the contrast (`-d`) controls how perceptually distinct the accent colors
@@ -157,10 +157,10 @@ theme pipeline can be seen in detail below:
157
157
  ![Generation pipeline](images/theme_generation_pipeline.png)
158
158
 
159
159
  This figure demonstrates how `kitty` themes are generated, but the process is
160
- generic to any palette, scheme, and app. This implemented in two stages using
161
- the `monobiome` CLI:
160
+ generic to any palette, scheme, and app. This is implemented in two stages
161
+ using the `monobiome` CLI:
162
162
 
163
- - First generate the scheme file, the definitions that respect perceptual
163
+ - First generate the scheme file, the lightness choices that achieve perceptual
164
164
  uniformity of accents with respect to the base monotone:
165
165
 
166
166
  ```sh
@@ -177,19 +177,21 @@ the `monobiome` CLI:
177
177
  monobiome fill scheme.toml templates/kitty/active.theme -o kitty.theme
178
178
  ```
179
179
 
180
- This writes a concrete theme to `kitty.theme` that matches the user
181
- preferences, i.e., the contrast (`-d`), background lightness (`-l`), mode
182
- (`dark`), and biome (`grassland`). Every part of this process can be
183
- customized: the scheme parameters, the scheme definitions/file, the app
184
- template.
180
+ This writes a concrete `kitty` theme to `kitty.theme` that matches the user
181
+ preferences as captured in the previously generated scheme file, i.e., the
182
+ contrast (`-d`), background lightness (`-l`), mode (`dark`), and biome
183
+ (`grassland`). Every part of this process can be customized: the scheme
184
+ parameters, the scheme definitions/file, the app template.
185
185
 
186
- Running these commands in sequence from the repo root should work
187
- out-of-the-box, after having installed the CLI tool.
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.
188
192
 
189
- The `monobiome` CLI
190
- produces the scheme file for requested parameters, and the [`symconf`][3] CLI
191
- pushes palette colors through the scheme and into the app templates to yield a
192
- concrete theme.
193
+ Running these commands in sequence from the repo root should work
194
+ out-of-the-box after having installed the CLI tool.
193
195
 
194
196
  ## Applications
195
197
  This repo provides palette-agnostic theme templates for `kitty`,
@@ -218,7 +220,7 @@ One can set these themes for the provided applications as follows:
218
220
  ```
219
221
 
220
222
  Themes are generated using the [`kitty` theme
221
- template](templates/apps/kitty/templates/active.theme).
223
+ template](templates/kitty/active.theme).
222
224
 
223
225
  - `vim`/`neovim`
224
226
 
@@ -233,7 +235,7 @@ One can set these themes for the provided applications as follows:
233
235
  ```
234
236
 
235
237
  Themes are generated using the [`vim` theme
236
- template](templates/apps/nvim/templates/theme.vim).
238
+ template](templates/nvim/theme.vim).
237
239
 
238
240
  - `fzf`
239
241
 
@@ -246,7 +248,7 @@ One can set these themes for the provided applications as follows:
246
248
  ```
247
249
 
248
250
  Themes are generated using the [`fzf` theme
249
- template](templates/apps/fzf/templates/active.theme).
251
+ template](templates/fzf/active.theme).
250
252
 
251
253
  - Firefox
252
254
 
@@ -254,13 +256,11 @@ One can set these themes for the provided applications as follows:
254
256
  add-ons][2], and switch between light/dark schemes based on system settings.
255
257
  You can also download raw XPI files for each theme in `app-config/firefox/`,
256
258
  each of which is generated using the [Firefox `manifest.json`
257
- template](templates/apps/firefox/templates/none-dark.manifest.json).
259
+ template](templates/firefox/auto-manifest.json).
258
260
 
259
261
  Static [light][4] and [dark][5] themes are additionally available (i.e., that
260
262
  don't change with system settings).
261
263
 
262
- ![Firefox theme previews](images/firefox/themes.png)
263
-
264
264
  ## CLI installation
265
265
  A brief theme generation guide was provided in the [Generation
266
266
  section](#generation), making use of the `monobiome` CLI. This tool can be
@@ -272,7 +272,7 @@ uv tool install monobiome
272
272
  pipx install monobiome
273
273
  ```
274
274
 
275
- The `monobiome` has provides three subcommands:
275
+ `monobiome` provides three subcommands:
276
276
 
277
277
  - `monobiome palette`: generate palette files from raw parameterized curves
278
278
 
@@ -335,6 +335,14 @@ The `monobiome` has provides three subcommands:
335
335
  output file to write filled template
336
336
  ```
337
337
 
338
+ ## Config management
339
+ The `monobiome` CLI tool attempts to provide the minimal functionality needed
340
+ to produce customized themes for individual applications. If seeking a more
341
+ holistic, system-wide approach, you might consider using [`symconf`][3], a
342
+ general-purpose application config manager. `symconf` provides the templating
343
+ subsystem used for `monobiome` internals, and can be configured to apply live
344
+ theme updates to many apps with a single command line invocation.
345
+
338
346
 
339
347
  [1]: https://github.com/isa/TextMate-Themes/blob/master/monoindustrial.tmTheme
340
348
  [2]: https://addons.mozilla.org/en-US/firefox/collections/18495484/monobiome/
@@ -30,13 +30,13 @@ both of which have fixed hue values and vary from 10% to 98% lightness.
30
30
  Monotone curves have fixed chroma, whereas the accent curves' chroma varies
31
31
  smoothly as a function of lightness within sRGB gamut bounds.
32
32
 
33
- | Chroma curves | Color trajectories |
34
- |---|---|
35
- | ![Chroma curves](images/curves/cstar-curves-v140.png) | ![Trajectories](images/trajectories.gif) |
33
+ | Chroma curves | Color trajectories |
34
+ |----------------------------------------------------------|------------------------------------------|
35
+ | ![Chroma curves](images/release/1.5.2/chroma-curves.png) | ![Trajectories](images/trajectories.gif) |
36
36
 
37
- | Palette |
38
- |---|
39
- | ![Palette](images/palette.png) |
37
+ | Palette |
38
+ |----------------------------------------------|
39
+ | ![Palette](images/release/1.5.2/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
@@ -60,8 +60,8 @@ varying only in lightness from dark to light grey.
60
60
 
61
61
  ## Themes
62
62
 
63
- | Dark themes | Light themes |
64
- |---|---|
63
+ | Dark themes | Light themes |
64
+ |----------------------------------------|------------------------------------------|
65
65
  | ![Dark themes](images/dark_themes.png) | ![Light themes](images/light_themes.png) |
66
66
 
67
67
  Themes are derived from the `monobiome` palette by selecting a monotone base
@@ -78,10 +78,10 @@ to the background.
78
78
  The following plots show the intersection of the sphere centered at a fixed
79
79
  background color (`alpine` biome with a lightness of 20) under variable radii:
80
80
 
81
- | | `-l 20 -d 0.3` | `-l 20 -d 0.4` | `-l 20 -d 0.5` |
82
- |---|---|---|---|
83
- | Color visualization | ![](images/oklch/mb_b20_d30.gif) | ![](images/oklch/mb_b20_d40.gif) | ![](images/oklch/mb_b20_d50.gif) |
84
- | Editor preview | ![](images/render/v140-demo-alpine-dark-d0.3.png) | ![](images/render/v140-demo-alpine-dark-d0.4.png) | ![](images/render/v140-demo-alpine-dark-d0.5.png) |
81
+ | | `-l 20 -d 0.3` | `-l 20 -d 0.4` | `-l 20 -d 0.5` |
82
+ |---------------------|---------------------------------------------------|---------------------------------------------------|---------------------------------------------------|
83
+ | Color visualization | ![](images/oklch/mb_b20_d30.gif) | ![](images/oklch/mb_b20_d40.gif) | ![](images/oklch/mb_b20_d50.gif) |
84
+ | Editor preview | ![](images/render/v140-demo-alpine-dark-d0.3.png) | ![](images/render/v140-demo-alpine-dark-d0.4.png) | ![](images/render/v140-demo-alpine-dark-d0.5.png) |
85
85
 
86
86
  In short, the base lightness (`-l`) dictates the brightness of the background,
87
87
  and the contrast (`-d`) controls how perceptually distinct the accent colors
@@ -117,10 +117,10 @@ theme pipeline can be seen in detail below:
117
117
  ![Generation pipeline](images/theme_generation_pipeline.png)
118
118
 
119
119
  This figure demonstrates how `kitty` themes are generated, but the process is
120
- generic to any palette, scheme, and app. This implemented in two stages using
121
- the `monobiome` CLI:
120
+ generic to any palette, scheme, and app. This is implemented in two stages
121
+ using the `monobiome` CLI:
122
122
 
123
- - First generate the scheme file, the definitions that respect perceptual
123
+ - First generate the scheme file, the lightness choices that achieve perceptual
124
124
  uniformity of accents with respect to the base monotone:
125
125
 
126
126
  ```sh
@@ -137,19 +137,21 @@ the `monobiome` CLI:
137
137
  monobiome fill scheme.toml templates/kitty/active.theme -o kitty.theme
138
138
  ```
139
139
 
140
- This writes a concrete theme to `kitty.theme` that matches the user
141
- preferences, i.e., the contrast (`-d`), background lightness (`-l`), mode
142
- (`dark`), and biome (`grassland`). Every part of this process can be
143
- customized: the scheme parameters, the scheme definitions/file, the app
144
- template.
140
+ This writes a concrete `kitty` theme to `kitty.theme` that matches the user
141
+ preferences as captured in the previously generated scheme file, i.e., the
142
+ contrast (`-d`), background lightness (`-l`), mode (`dark`), and biome
143
+ (`grassland`). Every part of this process can be customized: the scheme
144
+ parameters, the scheme definitions/file, the app template.
145
145
 
146
- Running these commands in sequence from the repo root should work
147
- out-of-the-box, after having installed the CLI tool.
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.
148
152
 
149
- The `monobiome` CLI
150
- produces the scheme file for requested parameters, and the [`symconf`][3] CLI
151
- pushes palette colors through the scheme and into the app templates to yield a
152
- concrete theme.
153
+ Running these commands in sequence from the repo root should work
154
+ out-of-the-box after having installed the CLI tool.
153
155
 
154
156
  ## Applications
155
157
  This repo provides palette-agnostic theme templates for `kitty`,
@@ -178,7 +180,7 @@ One can set these themes for the provided applications as follows:
178
180
  ```
179
181
 
180
182
  Themes are generated using the [`kitty` theme
181
- template](templates/apps/kitty/templates/active.theme).
183
+ template](templates/kitty/active.theme).
182
184
 
183
185
  - `vim`/`neovim`
184
186
 
@@ -193,7 +195,7 @@ One can set these themes for the provided applications as follows:
193
195
  ```
194
196
 
195
197
  Themes are generated using the [`vim` theme
196
- template](templates/apps/nvim/templates/theme.vim).
198
+ template](templates/nvim/theme.vim).
197
199
 
198
200
  - `fzf`
199
201
 
@@ -206,7 +208,7 @@ One can set these themes for the provided applications as follows:
206
208
  ```
207
209
 
208
210
  Themes are generated using the [`fzf` theme
209
- template](templates/apps/fzf/templates/active.theme).
211
+ template](templates/fzf/active.theme).
210
212
 
211
213
  - Firefox
212
214
 
@@ -214,13 +216,11 @@ One can set these themes for the provided applications as follows:
214
216
  add-ons][2], and switch between light/dark schemes based on system settings.
215
217
  You can also download raw XPI files for each theme in `app-config/firefox/`,
216
218
  each of which is generated using the [Firefox `manifest.json`
217
- template](templates/apps/firefox/templates/none-dark.manifest.json).
219
+ template](templates/firefox/auto-manifest.json).
218
220
 
219
221
  Static [light][4] and [dark][5] themes are additionally available (i.e., that
220
222
  don't change with system settings).
221
223
 
222
- ![Firefox theme previews](images/firefox/themes.png)
223
-
224
224
  ## CLI installation
225
225
  A brief theme generation guide was provided in the [Generation
226
226
  section](#generation), making use of the `monobiome` CLI. This tool can be
@@ -232,7 +232,7 @@ uv tool install monobiome
232
232
  pipx install monobiome
233
233
  ```
234
234
 
235
- The `monobiome` has provides three subcommands:
235
+ `monobiome` provides three subcommands:
236
236
 
237
237
  - `monobiome palette`: generate palette files from raw parameterized curves
238
238
 
@@ -295,6 +295,14 @@ The `monobiome` has provides three subcommands:
295
295
  output file to write filled template
296
296
  ```
297
297
 
298
+ ## Config management
299
+ The `monobiome` CLI tool attempts to provide the minimal functionality needed
300
+ to produce customized themes for individual applications. If seeking a more
301
+ holistic, system-wide approach, you might consider using [`symconf`][3], a
302
+ general-purpose application config manager. `symconf` provides the templating
303
+ subsystem used for `monobiome` internals, and can be configured to apply live
304
+ theme updates to many apps with a single command line invocation.
305
+
298
306
 
299
307
  [1]: https://github.com/isa/TextMate-Themes/blob/master/monoindustrial.tmTheme
300
308
  [2]: https://addons.mozilla.org/en-US/firefox/collections/18495484/monobiome/
@@ -17,7 +17,7 @@ def register_parser(subparsers: _SubparserType) -> None:
17
17
  type=str,
18
18
  default="hex",
19
19
  choices=["hex", "oklch"],
20
- help="Color notation to export (either hex or oklch)",
20
+ help="color notation to export (either hex or oklch)",
21
21
  )
22
22
  parser.add_argument(
23
23
  "-f",
@@ -25,13 +25,13 @@ def register_parser(subparsers: _SubparserType) -> None:
25
25
  type=str,
26
26
  default="toml",
27
27
  choices=["json", "toml"],
28
- help="Format of palette file (either JSON or TOML)",
28
+ help="format of palette file (either JSON or TOML)",
29
29
  )
30
30
  parser.add_argument(
31
31
  "-o",
32
32
  "--output",
33
33
  type=str,
34
- help="Output file to write palette content",
34
+ help="output file to write palette content",
35
35
  )
36
36
 
37
37
  parser.set_defaults(func=handle_palette)
@@ -16,13 +16,13 @@ def register_parser(subparsers: _SubparserType) -> None:
16
16
  "mode",
17
17
  type=str,
18
18
  choices=["dark", "light"],
19
- help="Scheme mode (light or dark)"
19
+ help="scheme mode (light or dark)"
20
20
  )
21
21
  parser.add_argument(
22
22
  "biome",
23
23
  type=str,
24
24
  choices=list(monotone_h_map.keys()),
25
- help="Biome setting for scheme."
25
+ help="biome setting for scheme"
26
26
  )
27
27
  parser.add_argument(
28
28
  "-m",
@@ -30,7 +30,7 @@ def register_parser(subparsers: _SubparserType) -> None:
30
30
  type=str,
31
31
  default="oklch",
32
32
  choices=["wcag", "oklch", "lightness"],
33
- help="Metric to use for measuring swatch distances."
33
+ help="metric to use for measuring swatch distances"
34
34
  )
35
35
 
36
36
  # e.g., wcag=4.5; oklch=0.40; lightness=40
@@ -39,13 +39,13 @@ def register_parser(subparsers: _SubparserType) -> None:
39
39
  "--distance",
40
40
  type=float,
41
41
  default=0.40,
42
- help="Distance threshold for specified metric",
42
+ help="distance threshold for specified metric",
43
43
  )
44
44
  parser.add_argument(
45
45
  "-o",
46
46
  "--output",
47
47
  type=str,
48
- help="Output file to write scheme content",
48
+ help="output file to write scheme content",
49
49
  )
50
50
 
51
51
  # these params remain rooted in lightness; no need to accommodate metric
@@ -58,13 +58,13 @@ def register_parser(subparsers: _SubparserType) -> None:
58
58
  "--l-base",
59
59
  type=int,
60
60
  default=20,
61
- help="Minimum lightness level (default: 20)",
61
+ help="minimum lightness level (default: 20)",
62
62
  )
63
63
  parser.add_argument(
64
64
  "--l-step",
65
65
  type=int,
66
66
  default=5,
67
- help="Lightness step size (default: 5)",
67
+ help="lightness step size (default: 5)",
68
68
  )
69
69
 
70
70
  # gaps
@@ -72,19 +72,19 @@ def register_parser(subparsers: _SubparserType) -> None:
72
72
  "--fg-gap",
73
73
  type=int,
74
74
  default=50,
75
- help="Foreground lightness gap (default: 50)",
75
+ help="foreground lightness gap (default: 50)",
76
76
  )
77
77
  parser.add_argument(
78
78
  "--grey-gap",
79
79
  type=int,
80
80
  default=30,
81
- help="Grey lightness gap (default: 30)",
81
+ help="grey lightness gap (default: 30)",
82
82
  )
83
83
  parser.add_argument(
84
84
  "--term-fg-gap",
85
85
  type=int,
86
86
  default=65,
87
- help="Terminal foreground lightness gap (default: 60)",
87
+ help="terminal foreground lightness gap (default: 60)",
88
88
  )
89
89
 
90
90
  parser.set_defaults(func=handle_scheme)
@@ -121,3 +121,21 @@ for h_str, L_points_C in Lpoints_Cqbr_Hmap.items():
121
121
  max(0, min(_C, l_maxC_h(_L, _h)))
122
122
  for _L, _C in zip(L_points, L_points_C, strict=True)
123
123
  ]
124
+
125
+
126
+ # strictly enforce curve bounds s.t. there are no intersections
127
+ # order is determined by the max attained chromap
128
+ max_Cstar_Horder = [
129
+ (h_str, max(Lpoints_Cstar))
130
+ for h_str, Lpoints_Cstar in Lpoints_Cstar_Hmap.items()
131
+ ]
132
+ max_Cstar_Horder = sorted(max_Cstar_Horder, key=lambda t: t[1], reverse=True)
133
+
134
+ for i in range(len(max_Cstar_Horder)-1):
135
+ outer_h, _ = max_Cstar_Horder[i]
136
+ inner_h, _ = max_Cstar_Horder[i+1]
137
+
138
+ Lpoints_Cstar_Hmap[inner_h] = [
139
+ min(inner_c, Lpoints_Cstar_Hmap[outer_h][ci])
140
+ for ci, inner_c in enumerate(Lpoints_Cstar_Hmap[inner_h])
141
+ ]
@@ -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})"
@@ -1,7 +1,11 @@
1
+ from importlib.metadata import version
2
+
1
3
  import numpy as np
2
4
  import matplotlib.pyplot as plt
3
5
  from coloraide import Color
6
+ from matplotlib.collections import LineCollection
4
7
 
8
+ from monobiome.util import srgb8_from_color
5
9
  from monobiome.palette import compute_hlc_map
6
10
  from monobiome.constants import (
7
11
  h_map,
@@ -10,11 +14,13 @@ from monobiome.constants import (
10
14
  accent_h_map,
11
15
  monotone_h_map,
12
16
  Lspace_Cmax_Hmap,
17
+ max_Cstar_Horder,
13
18
  Lpoints_Cstar_Hmap,
14
19
  )
15
20
 
21
+ VERSION = version("monobiome")
16
22
 
17
- def plot_hue_chroma_bounds() -> None:
23
+ def plot_hue_chroma_bounds() -> tuple[plt.Figure, plt.Axes]:
18
24
  name_h_map = {}
19
25
  ax_h_map = {}
20
26
  fig, axes = plt.subplots(
@@ -63,43 +69,56 @@ def plot_hue_chroma_bounds() -> None:
63
69
  ncol=3
64
70
  )
65
71
 
66
- plt.suptitle("$C^*$ curves for hue groups")
67
- plt.show()
72
+ plt.suptitle(f"$C^*$ curves for hue groups (v{VERSION})")
68
73
 
74
+ return fig, axes
69
75
 
70
- def plot_hue_chroma_star() -> None:
76
+ def plot_hue_chroma_star() -> tuple[plt.Figure, plt.Axes]:
71
77
  fig, ax = plt.subplots(1, 1, figsize=(8, 6))
72
78
 
73
- # uncomment to preview 5 core term colors
74
79
  colors = accent_h_map.keys()
75
- #colors = set(["red", "orange", "yellow", "green", "blue"])
80
+ # uncomment to preview just the 5 core term colors
81
+ # colors = set(["red", "orange", "yellow", "green", "blue"])
82
+
83
+ for h_str, _ in max_Cstar_Horder:
84
+ Lpoints_Cstar = Lpoints_Cstar_Hmap[h_str]
76
85
 
77
- for h_str in Lpoints_Cstar_Hmap:
78
86
  if h_str not in accent_h_map or h_str not in colors:
79
87
  continue
80
- ax.fill_between(
81
- L_points,
82
- Lpoints_Cstar_Hmap[h_str],
83
- alpha=0.2,
84
- color='grey',
85
- label=h_str
86
- )
87
-
88
- x, y = L_points, Lpoints_Cstar_Hmap[h_str]
89
- n = int(0.45*len(x))
90
- ax.text(x[n], y[n]-0.01, h_str, rotation=10, va='center', ha='left')
88
+
89
+ _h = h_map[h_str]
90
+ h_colors = [
91
+ Color(
92
+ 'oklch', [_l/100, _c, _h]
93
+ ).convert("srgb").fit(method="oklch-chroma")
94
+ for _l, _c in zip(L_points, Lpoints_Cstar, strict=True)
95
+ ]
96
+
97
+ x = np.asarray(L_points)
98
+ y = np.asarray(Lpoints_Cstar)
99
+ pts = np.column_stack([x, y]).reshape(-1, 1, 2)
100
+ segs = np.concatenate([pts[:-1], pts[1:]], axis=1)
101
+ rgb = np.asarray(h_colors)
102
+ seg_colors = (rgb[:-1] + rgb[1:]) / 2
103
+ lc = LineCollection(segs, colors=seg_colors, linewidth=3,
104
+ capstyle="round", joinstyle="round",
105
+ label=h_str)
106
+
107
+ ax.add_collection(lc)
108
+ ax.autoscale_view()
91
109
 
92
110
  ax.set_xlabel("Lightness (%)")
93
111
  ax.set_xticks([L_points[0], 45, 50, 55, 60, 65, 70, L_points[-1]])
94
- plt.suptitle("$C^*$ curves (v1.4.0)")
95
- fig.show()
96
112
 
113
+ plt.suptitle(f"$C^*$ curves (v{VERSION})")
114
+
115
+ return fig, ax
97
116
 
98
117
  def palette_image(
99
118
  palette: dict[str, dict[int, str]],
100
119
  cell_size: int = 40,
101
120
  keys: list[str] | None = None
102
- ) -> tuple[np.ndarray, list[str], list[list[int]], int, int]:
121
+ ) -> tuple[np.ndarray, list[str], list[list[int]]]:
103
122
  names = list(palette.keys()) if keys is None else keys
104
123
 
105
124
  row_count = len(names)
@@ -108,7 +127,7 @@ def palette_image(
108
127
 
109
128
  h = row_count * cell_size
110
129
  w = max_cols * cell_size
111
- img = np.ones((h, w, 3), float)
130
+ img = np.ones((h, w, 3), int)
112
131
 
113
132
  lightness_keys_per_row = []
114
133
 
@@ -117,14 +136,12 @@ def palette_image(
117
136
  lkeys = sorted(shades.keys())
118
137
  lightness_keys_per_row.append(lkeys)
119
138
  for c, k in enumerate(lkeys):
120
- col = Color(shades[k]).convert("srgb").fit(method="clip")
121
- rgb = [col["r"], col["g"], col["b"]]
139
+ rgb = srgb8_from_color(shades[k])
122
140
  r0, r1 = r * cell_size, (r + 1) * cell_size
123
141
  c0, c1 = c * cell_size, (c + 1) * cell_size
124
142
  img[r0:r1, c0:c1, :] = rgb
125
143
 
126
- return img, names, lightness_keys_per_row, cell_size, max_cols
127
-
144
+ return img, names, lightness_keys_per_row
128
145
 
129
146
  def show_palette(
130
147
  palette: dict[str, dict[int, str]],
@@ -133,9 +150,7 @@ def show_palette(
133
150
  show_labels: bool = True,
134
151
  dpi: int = 100,
135
152
  ) -> tuple[plt.Figure, plt.Axes]:
136
- img, names, keys, cell_size, max_cols = palette_image(
137
- palette, cell_size, keys=keys
138
- )
153
+ img, names, _ = palette_image(palette, cell_size, keys=keys)
139
154
 
140
155
  fig_w = img.shape[1] / 100
141
156
  fig_h = img.shape[0] / 100
@@ -143,7 +158,7 @@ def show_palette(
143
158
  if show_labels:
144
159
  fig, ax = plt.subplots(figsize=(fig_w, fig_h), dpi=dpi)
145
160
 
146
- ax.imshow(img, interpolation="none", origin="upper")
161
+ ax.imshow(img, interpolation="nearest", origin="upper")
147
162
  ax.set_xticks([])
148
163
 
149
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.0
3
+ Version: 1.5.3
4
4
  Summary: Monobiome color palette
5
5
  Author-email: Sam Griesemer <git@olog.io>
6
6
  License-Expression: MIT
@@ -70,13 +70,13 @@ both of which have fixed hue values and vary from 10% to 98% lightness.
70
70
  Monotone curves have fixed chroma, whereas the accent curves' chroma varies
71
71
  smoothly as a function of lightness within sRGB gamut bounds.
72
72
 
73
- | Chroma curves | Color trajectories |
74
- |---|---|
75
- | ![Chroma curves](images/curves/cstar-curves-v140.png) | ![Trajectories](images/trajectories.gif) |
73
+ | Chroma curves | Color trajectories |
74
+ |----------------------------------------------------------|------------------------------------------|
75
+ | ![Chroma curves](images/release/1.5.2/chroma-curves.png) | ![Trajectories](images/trajectories.gif) |
76
76
 
77
- | Palette |
78
- |---|
79
- | ![Palette](images/palette.png) |
77
+ | Palette |
78
+ |----------------------------------------------|
79
+ | ![Palette](images/release/1.5.2/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
@@ -100,8 +100,8 @@ varying only in lightness from dark to light grey.
100
100
 
101
101
  ## Themes
102
102
 
103
- | Dark themes | Light themes |
104
- |---|---|
103
+ | Dark themes | Light themes |
104
+ |----------------------------------------|------------------------------------------|
105
105
  | ![Dark themes](images/dark_themes.png) | ![Light themes](images/light_themes.png) |
106
106
 
107
107
  Themes are derived from the `monobiome` palette by selecting a monotone base
@@ -118,10 +118,10 @@ to the background.
118
118
  The following plots show the intersection of the sphere centered at a fixed
119
119
  background color (`alpine` biome with a lightness of 20) under variable radii:
120
120
 
121
- | | `-l 20 -d 0.3` | `-l 20 -d 0.4` | `-l 20 -d 0.5` |
122
- |---|---|---|---|
123
- | Color visualization | ![](images/oklch/mb_b20_d30.gif) | ![](images/oklch/mb_b20_d40.gif) | ![](images/oklch/mb_b20_d50.gif) |
124
- | Editor preview | ![](images/render/v140-demo-alpine-dark-d0.3.png) | ![](images/render/v140-demo-alpine-dark-d0.4.png) | ![](images/render/v140-demo-alpine-dark-d0.5.png) |
121
+ | | `-l 20 -d 0.3` | `-l 20 -d 0.4` | `-l 20 -d 0.5` |
122
+ |---------------------|---------------------------------------------------|---------------------------------------------------|---------------------------------------------------|
123
+ | Color visualization | ![](images/oklch/mb_b20_d30.gif) | ![](images/oklch/mb_b20_d40.gif) | ![](images/oklch/mb_b20_d50.gif) |
124
+ | Editor preview | ![](images/render/v140-demo-alpine-dark-d0.3.png) | ![](images/render/v140-demo-alpine-dark-d0.4.png) | ![](images/render/v140-demo-alpine-dark-d0.5.png) |
125
125
 
126
126
  In short, the base lightness (`-l`) dictates the brightness of the background,
127
127
  and the contrast (`-d`) controls how perceptually distinct the accent colors
@@ -157,10 +157,10 @@ theme pipeline can be seen in detail below:
157
157
  ![Generation pipeline](images/theme_generation_pipeline.png)
158
158
 
159
159
  This figure demonstrates how `kitty` themes are generated, but the process is
160
- generic to any palette, scheme, and app. This implemented in two stages using
161
- the `monobiome` CLI:
160
+ generic to any palette, scheme, and app. This is implemented in two stages
161
+ using the `monobiome` CLI:
162
162
 
163
- - First generate the scheme file, the definitions that respect perceptual
163
+ - First generate the scheme file, the lightness choices that achieve perceptual
164
164
  uniformity of accents with respect to the base monotone:
165
165
 
166
166
  ```sh
@@ -177,19 +177,21 @@ the `monobiome` CLI:
177
177
  monobiome fill scheme.toml templates/kitty/active.theme -o kitty.theme
178
178
  ```
179
179
 
180
- This writes a concrete theme to `kitty.theme` that matches the user
181
- preferences, i.e., the contrast (`-d`), background lightness (`-l`), mode
182
- (`dark`), and biome (`grassland`). Every part of this process can be
183
- customized: the scheme parameters, the scheme definitions/file, the app
184
- template.
180
+ This writes a concrete `kitty` theme to `kitty.theme` that matches the user
181
+ preferences as captured in the previously generated scheme file, i.e., the
182
+ contrast (`-d`), background lightness (`-l`), mode (`dark`), and biome
183
+ (`grassland`). Every part of this process can be customized: the scheme
184
+ parameters, the scheme definitions/file, the app template.
185
185
 
186
- Running these commands in sequence from the repo root should work
187
- out-of-the-box, after having installed the CLI tool.
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.
188
192
 
189
- The `monobiome` CLI
190
- produces the scheme file for requested parameters, and the [`symconf`][3] CLI
191
- pushes palette colors through the scheme and into the app templates to yield a
192
- concrete theme.
193
+ Running these commands in sequence from the repo root should work
194
+ out-of-the-box after having installed the CLI tool.
193
195
 
194
196
  ## Applications
195
197
  This repo provides palette-agnostic theme templates for `kitty`,
@@ -218,7 +220,7 @@ One can set these themes for the provided applications as follows:
218
220
  ```
219
221
 
220
222
  Themes are generated using the [`kitty` theme
221
- template](templates/apps/kitty/templates/active.theme).
223
+ template](templates/kitty/active.theme).
222
224
 
223
225
  - `vim`/`neovim`
224
226
 
@@ -233,7 +235,7 @@ One can set these themes for the provided applications as follows:
233
235
  ```
234
236
 
235
237
  Themes are generated using the [`vim` theme
236
- template](templates/apps/nvim/templates/theme.vim).
238
+ template](templates/nvim/theme.vim).
237
239
 
238
240
  - `fzf`
239
241
 
@@ -246,7 +248,7 @@ One can set these themes for the provided applications as follows:
246
248
  ```
247
249
 
248
250
  Themes are generated using the [`fzf` theme
249
- template](templates/apps/fzf/templates/active.theme).
251
+ template](templates/fzf/active.theme).
250
252
 
251
253
  - Firefox
252
254
 
@@ -254,13 +256,11 @@ One can set these themes for the provided applications as follows:
254
256
  add-ons][2], and switch between light/dark schemes based on system settings.
255
257
  You can also download raw XPI files for each theme in `app-config/firefox/`,
256
258
  each of which is generated using the [Firefox `manifest.json`
257
- template](templates/apps/firefox/templates/none-dark.manifest.json).
259
+ template](templates/firefox/auto-manifest.json).
258
260
 
259
261
  Static [light][4] and [dark][5] themes are additionally available (i.e., that
260
262
  don't change with system settings).
261
263
 
262
- ![Firefox theme previews](images/firefox/themes.png)
263
-
264
264
  ## CLI installation
265
265
  A brief theme generation guide was provided in the [Generation
266
266
  section](#generation), making use of the `monobiome` CLI. This tool can be
@@ -272,7 +272,7 @@ uv tool install monobiome
272
272
  pipx install monobiome
273
273
  ```
274
274
 
275
- The `monobiome` has provides three subcommands:
275
+ `monobiome` provides three subcommands:
276
276
 
277
277
  - `monobiome palette`: generate palette files from raw parameterized curves
278
278
 
@@ -335,6 +335,14 @@ The `monobiome` has provides three subcommands:
335
335
  output file to write filled template
336
336
  ```
337
337
 
338
+ ## Config management
339
+ The `monobiome` CLI tool attempts to provide the minimal functionality needed
340
+ to produce customized themes for individual applications. If seeking a more
341
+ holistic, system-wide approach, you might consider using [`symconf`][3], a
342
+ general-purpose application config manager. `symconf` provides the templating
343
+ subsystem used for `monobiome` internals, and can be configured to apply live
344
+ theme updates to many apps with a single command line invocation.
345
+
338
346
 
339
347
  [1]: https://github.com/isa/TextMate-Themes/blob/master/monoindustrial.tmTheme
340
348
  [2]: https://addons.mozilla.org/en-US/firefox/collections/18495484/monobiome/
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "monobiome"
7
- version = "1.5.0"
7
+ version = "1.5.3"
8
8
  description = "Monobiome color palette"
9
9
  requires-python = ">=3.12"
10
10
  authors = [
File without changes
File without changes
File without changes