monobiome 1.3.1__py3-none-any.whl → 1.5.0__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/__main__.py CHANGED
@@ -10,7 +10,7 @@ def main() -> None:
10
10
  configure_logging(args.log_level)
11
11
 
12
12
  if "func" in args:
13
- args.func(args)
13
+ args.func(args, parser)
14
14
  else:
15
15
  parser.print_help()
16
16
 
monobiome/cli/__init__.py CHANGED
@@ -1,7 +1,7 @@
1
1
  import logging
2
- import argparse
2
+ from argparse import ArgumentParser
3
3
 
4
- from monobiome.cli import scheme, palette
4
+ from monobiome.cli import fill, scheme, palette
5
5
 
6
6
  logger: logging.Logger = logging.getLogger(__name__)
7
7
 
@@ -12,8 +12,8 @@ def configure_logging(log_level: int) -> None:
12
12
 
13
13
  logger.setLevel(log_level)
14
14
 
15
- def create_parser() -> argparse.ArgumentParser:
16
- parser = argparse.ArgumentParser(
15
+ def create_parser() -> ArgumentParser:
16
+ parser = ArgumentParser(
17
17
  description="Accent modeling CLI",
18
18
  )
19
19
  parser.add_argument(
@@ -26,7 +26,8 @@ def create_parser() -> argparse.ArgumentParser:
26
26
 
27
27
  subparsers = parser.add_subparsers(help="subcommand help")
28
28
 
29
- palette.register_parser(subparsers)
29
+ fill.register_parser(subparsers)
30
30
  scheme.register_parser(subparsers)
31
+ palette.register_parser(subparsers)
31
32
 
32
33
  return parser
monobiome/cli/fill.py ADDED
@@ -0,0 +1,78 @@
1
+ import sys
2
+ import tomllib
3
+ from pathlib import Path
4
+ from argparse import Namespace, ArgumentParser
5
+
6
+ from symconf.template import Template, TOMLTemplate
7
+
8
+ from monobiome.util import _SubparserType
9
+ from monobiome.palette import generate_palette
10
+
11
+
12
+ def register_parser(subparsers: _SubparserType) -> None:
13
+ parser = subparsers.add_parser(
14
+ "fill",
15
+ help="fill scheme templates for applications"
16
+ )
17
+
18
+ parser.add_argument(
19
+ "scheme",
20
+ type=str,
21
+ help="scheme file path"
22
+ )
23
+ parser.add_argument(
24
+ "template",
25
+ nargs="?",
26
+ help="template file path (defaults to stdin)"
27
+ )
28
+ parser.add_argument(
29
+ "-p",
30
+ "--palette",
31
+ type=str,
32
+ help="palette file to use for color definitions",
33
+ )
34
+ parser.add_argument(
35
+ "-o",
36
+ "--output",
37
+ type=str,
38
+ help="output file to write filled template",
39
+ )
40
+
41
+ parser.set_defaults(func=handle_fill)
42
+
43
+
44
+ def handle_fill(args: Namespace, parser: ArgumentParser) -> None:
45
+ scheme = Path(args.scheme)
46
+ output = args.output
47
+
48
+ if args.template is None:
49
+ if sys.stdin.isatty():
50
+ parser.error("no template provided (file or stdin)")
51
+ return
52
+ template_content = sys.stdin.read()
53
+ elif args.template == "-":
54
+ template_content = sys.stdin.read()
55
+ else:
56
+ try:
57
+ template_content = Path(args.template).read_text()
58
+ except OSError as e:
59
+ parser.error(f"cannot read template file: {e}")
60
+
61
+ if args.palette:
62
+ try:
63
+ palette_toml = Path(args.palette).read_text()
64
+ except OSError as e:
65
+ parser.error(f"cannot read palette file: {e}")
66
+ return
67
+ else:
68
+ palette_toml = generate_palette("hex", "toml")
69
+
70
+ palette_dict = tomllib.loads(palette_toml)
71
+ concrete_scheme = TOMLTemplate(scheme).fill_dict(palette_dict)
72
+ filled_template = Template(template_content).fill(concrete_scheme)
73
+
74
+ if output is None:
75
+ print(filled_template)
76
+ else:
77
+ with Path(output).open("w") as f:
78
+ f.write(filled_template)
monobiome/cli/palette.py CHANGED
@@ -1,5 +1,5 @@
1
- import argparse
2
1
  from pathlib import Path
2
+ from argparse import Namespace, ArgumentParser
3
3
 
4
4
  from monobiome.util import _SubparserType
5
5
  from monobiome.palette import generate_palette
@@ -37,7 +37,7 @@ def register_parser(subparsers: _SubparserType) -> None:
37
37
  parser.set_defaults(func=handle_palette)
38
38
 
39
39
 
40
- def handle_palette(args: argparse.Namespace) -> None:
40
+ def handle_palette(args: Namespace, parser: ArgumentParser) -> None:
41
41
  notation = args.notation
42
42
  file_format = args.format
43
43
  output = args.output
monobiome/cli/scheme.py CHANGED
@@ -1,5 +1,5 @@
1
- import argparse
2
1
  from pathlib import Path
2
+ from argparse import Namespace, ArgumentParser
3
3
 
4
4
  from monobiome.util import _SubparserType
5
5
  from monobiome.scheme import generate_scheme
@@ -90,7 +90,7 @@ def register_parser(subparsers: _SubparserType) -> None:
90
90
  parser.set_defaults(func=handle_scheme)
91
91
 
92
92
 
93
- def handle_scheme(args: argparse.Namespace) -> None:
93
+ def handle_scheme(args: Namespace, parser: ArgumentParser) -> None:
94
94
  output = args.output
95
95
 
96
96
  mode = args.mode
monobiome/curve.py CHANGED
@@ -9,8 +9,8 @@ def quad_bezier_rational(
9
9
  P1: float,
10
10
  P2: float,
11
11
  w: float,
12
- t: np.array,
13
- ) -> np.array:
12
+ t: np.ndarray,
13
+ ) -> np.ndarray:
14
14
  """
15
15
  Compute the point values of a quadratic rational Bezier curve.
16
16
 
@@ -32,7 +32,7 @@ def bezier_y_at_x(
32
32
  w: float,
33
33
  x: float,
34
34
  n: int = 400,
35
- ) -> np.array:
35
+ ) -> np.ndarray:
36
36
  """
37
37
  For the provided QBR parameters, provide the curve value at the given
38
38
  input.
monobiome/palette.py CHANGED
@@ -1,4 +1,5 @@
1
1
  import json
2
+ from typing import Any
2
3
  from functools import cache
3
4
  from importlib.metadata import version
4
5
 
@@ -12,7 +13,7 @@ from monobiome.constants import (
12
13
 
13
14
 
14
15
  @cache
15
- def compute_hlc_map(notation: str) -> dict[str, dict[int, str]]:
16
+ def compute_hlc_map(notation: str) -> dict[str, Any]:
16
17
  hlc_map = {}
17
18
 
18
19
  for h_str, Lpoints_Cstar in Lpoints_Cstar_Hmap.items():
@@ -44,7 +45,7 @@ def generate_palette(
44
45
  hlc_map["version"] = mb_version
45
46
  return json.dumps(hlc_map, indent=4)
46
47
  else:
47
- toml_lines = [f"version = {mb_version}", ""]
48
+ toml_lines = [f"version = \"{mb_version}\"", ""]
48
49
  for _h, _lc_map in hlc_map.items():
49
50
  toml_lines.append(f"[{_h}]")
50
51
  for _l, _c in _lc_map.items():
monobiome/plotting.py CHANGED
@@ -1,6 +1,8 @@
1
1
  import numpy as np
2
2
  import matplotlib.pyplot as plt
3
+ from coloraide import Color
3
4
 
5
+ from monobiome.palette import compute_hlc_map
4
6
  from monobiome.constants import (
5
7
  h_map,
6
8
  L_space,
@@ -52,8 +54,14 @@ def plot_hue_chroma_bounds() -> None:
52
54
  fig.subplots_adjust(top=0.9)
53
55
 
54
56
  handles, labels = axes[-1].get_legend_handles_labels()
55
- unique = dict(zip(labels, handles))
56
- fig.legend(unique.values(), unique.keys(), loc='lower center', bbox_to_anchor=(0.5, -0.06), ncol=3)
57
+ unique = dict(zip(labels, handles, strict=True))
58
+ fig.legend(
59
+ unique.values(),
60
+ unique.keys(),
61
+ loc='lower center',
62
+ bbox_to_anchor=(0.5, -0.06),
63
+ ncol=3
64
+ )
57
65
 
58
66
  plt.suptitle("$C^*$ curves for hue groups")
59
67
  plt.show()
@@ -87,11 +95,12 @@ def plot_hue_chroma_star() -> None:
87
95
  fig.show()
88
96
 
89
97
 
90
- def palette_image(palette, cell_size=40, keys=None):
91
- if keys is None:
92
- names = list(palette.keys())
93
- else:
94
- names = keys
98
+ def palette_image(
99
+ palette: dict[str, dict[int, str]],
100
+ cell_size: int = 40,
101
+ keys: list[str] | None = None
102
+ ) -> tuple[np.ndarray, list[str], list[list[int]], int, int]:
103
+ names = list(palette.keys()) if keys is None else keys
95
104
 
96
105
  row_count = len(names)
97
106
  col_counts = [len(palette[n]) for n in names]
@@ -105,9 +114,9 @@ def palette_image(palette, cell_size=40, keys=None):
105
114
 
106
115
  for r, name in enumerate(names):
107
116
  shades = palette[name]
108
- keys = sorted(shades.keys())
109
- lightness_keys_per_row.append(keys)
110
- for c, k in enumerate(keys):
117
+ lkeys = sorted(shades.keys())
118
+ lightness_keys_per_row.append(lkeys)
119
+ for c, k in enumerate(lkeys):
111
120
  col = Color(shades[k]).convert("srgb").fit(method="clip")
112
121
  rgb = [col["r"], col["g"], col["b"]]
113
122
  r0, r1 = r * cell_size, (r + 1) * cell_size
@@ -117,28 +126,50 @@ def palette_image(palette, cell_size=40, keys=None):
117
126
  return img, names, lightness_keys_per_row, cell_size, max_cols
118
127
 
119
128
 
120
- def show_palette(palette, cell_size=40, keys=None):
121
- img, names, keys, cell_size, max_cols = palette_image(palette, cell_size, keys=keys)
129
+ def show_palette(
130
+ palette: dict[str, dict[int, str]],
131
+ cell_size: int = 40,
132
+ keys: list[str] | None = None,
133
+ show_labels: bool = True,
134
+ dpi: int = 100,
135
+ ) -> tuple[plt.Figure, plt.Axes]:
136
+ img, names, keys, cell_size, max_cols = palette_image(
137
+ palette, cell_size, keys=keys
138
+ )
122
139
 
123
140
  fig_w = img.shape[1] / 100
124
141
  fig_h = img.shape[0] / 100
125
- fig, ax = plt.subplots(figsize=(fig_w, fig_h))
126
142
 
127
- ax.imshow(img, interpolation="none", origin="upper")
128
- ax.set_xticks([])
143
+ if show_labels:
144
+ fig, ax = plt.subplots(figsize=(fig_w, fig_h), dpi=dpi)
129
145
 
130
- ytick_pos = [(i + 0.5) * cell_size for i in range(len(names))]
131
- ax.set_yticks(ytick_pos)
132
- ax.set_yticklabels(names)
146
+ ax.imshow(img, interpolation="none", origin="upper")
147
+ ax.set_xticks([])
133
148
 
134
- ax.set_ylim(img.shape[0], 0) # ensures rows render correctly without half-cells
149
+ ytick_pos = [(i + 0.5) * cell_size for i in range(len(names))]
150
+ ax.set_yticks(ytick_pos)
151
+ ax.set_yticklabels(names)
152
+ ax.set_ylim(img.shape[0], 0) # ensures rows render w/o half-cells
135
153
 
136
- plt.show()
154
+ return fig, ax
137
155
 
156
+ fig = plt.figure(figsize=(fig_w, fig_h), dpi=dpi, frameon=False)
157
+ ax = fig.add_axes((0, 0, 1, 1), frame_on=False)
158
+ ax.imshow(
159
+ img,
160
+ interpolation="nearest",
161
+ origin="upper",
162
+ extent=(0, img.shape[1], img.shape[0], 0),
163
+ aspect="auto",
164
+ )
165
+ ax.set_xlim(0, img.shape[1])
166
+ ax.set_ylim(img.shape[0], 0)
167
+ ax.axis("off")
168
+ fig.subplots_adjust(0, 0, 1, 1, hspace=0, wspace=0)
138
169
 
139
- if __name__ == "__main__":
140
- from monobiome.constants import OKLCH_hL_dict
170
+ return fig, ax
141
171
 
172
+ if __name__ == "__main__":
142
173
  keys = [
143
174
  "alpine",
144
175
  "badlands",
@@ -172,5 +203,6 @@ if __name__ == "__main__":
172
203
  "blue",
173
204
  ]
174
205
 
175
- show_palette(OKLCH_hL_dict, cell_size=25, keys=keys)
176
- # show_palette(OKLCH_hL_dict, cell_size=1, keys=term_keys)
206
+ hlc_map = compute_hlc_map("oklch")
207
+ show_palette(hlc_map, cell_size=25, keys=keys)
208
+ # show_palette(hlc_map, cell_size=1, keys=term_keys)
monobiome/scheme.py CHANGED
@@ -1,5 +1,6 @@
1
1
  from functools import cache
2
2
  from collections.abc import Callable
3
+ from importlib.metadata import version
3
4
 
4
5
  from coloraide import Color
5
6
 
@@ -88,7 +89,7 @@ def generate_scheme_groups(
88
89
  grey_gap: int,
89
90
  term_fg_gap: int,
90
91
  accent_color_map: dict[str, str],
91
- ) -> tuple[dict[str, str], ...]:
92
+ ) -> tuple[list[tuple[str, str]], ...]:
92
93
  """
93
94
  Parameters:
94
95
  mode: one of ["dark", "light"]
@@ -125,15 +126,16 @@ def generate_scheme_groups(
125
126
  accent_colors = Lma_map.get(biome, {})
126
127
 
127
128
  meta_pairs = [
129
+ ("version", version("monobiome")),
128
130
  ("mode", mode),
129
131
  ("biome", biome),
130
132
  ("metric", metric),
131
- ("distance", distance),
132
- ("l_base", l_base),
133
- ("l_step", l_step),
134
- ("fg_gap", fg_gap),
135
- ("grey_gap", grey_gap),
136
- ("term_fg_gap", term_fg_gap),
133
+ ("distance", str(distance)),
134
+ ("l_base", str(l_base)),
135
+ ("l_step", str(l_step)),
136
+ ("fg_gap", str(fg_gap)),
137
+ ("grey_gap", str(grey_gap)),
138
+ ("term_fg_gap", str(term_fg_gap)),
137
139
  ]
138
140
 
139
141
  # note how selection_bg steps up by `l_step`, selection_fg steps down by
@@ -233,7 +235,11 @@ def generate_scheme(
233
235
  for lhs, rhs in pair_list
234
236
  ]
235
237
 
236
- scheme_pairs = []
238
+ mb_version = version("monobiome")
239
+ scheme_pairs = [
240
+ "# ++ monobiome scheme file ++",
241
+ f"# ++ generated CLI @ {mb_version} ++",
242
+ ]
237
243
  scheme_pairs += pair_strings(meta)
238
244
  scheme_pairs += pair_strings(mt)
239
245
  scheme_pairs += pair_strings(ac)
@@ -0,0 +1,343 @@
1
+ Metadata-Version: 2.4
2
+ Name: monobiome
3
+ Version: 1.5.0
4
+ Summary: Monobiome color palette
5
+ Author-email: Sam Griesemer <git@olog.io>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://doc.olog.io/monobiome
8
+ Project-URL: Documentation, https://doc.olog.io/monobiome
9
+ Project-URL: Repository, https://git.olog.io/olog/monobiome
10
+ Project-URL: Issues, https://git.olog.io/olog/monobiome/issues
11
+ Keywords: tempate-engine,color-palette
12
+ Classifier: Programming Language :: Python
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: End Users/Desktop
17
+ Requires-Python: >=3.12
18
+ Description-Content-Type: text/markdown
19
+ Requires-Dist: coloraide>=5.1
20
+ Requires-Dist: imageio[ffmpeg]>=2.37.2
21
+ Requires-Dist: kaleido>=1.1.0
22
+ Requires-Dist: matplotlib>=3.10.7
23
+ Requires-Dist: nbformat>=5.10.4
24
+ Requires-Dist: numpy>=2.3.4
25
+ Requires-Dist: pillow>=12.0.0
26
+ Requires-Dist: plotly>=6.3.1
27
+ Requires-Dist: pyqt5>=5.15.11
28
+ Requires-Dist: scipy>=1.16.2
29
+ Requires-Dist: symconf>=0.8.4
30
+ Provides-Extra: dev
31
+ Requires-Dist: ipykernel; extra == "dev"
32
+ Provides-Extra: doc
33
+ Requires-Dist: furo; extra == "doc"
34
+ Requires-Dist: myst-parser; extra == "doc"
35
+ Requires-Dist: sphinx; extra == "doc"
36
+ Requires-Dist: sphinx-togglebutton; extra == "doc"
37
+ Requires-Dist: sphinx-autodoc-typehints; extra == "doc"
38
+ Provides-Extra: test
39
+ Requires-Dist: pytest; extra == "test"
40
+
41
+ # Monobiome
42
+ `monobiome` is a minimal, balanced color palette for use in terminals and text
43
+ editors. It was designed in OKLCH space to achieve perceptual uniformity across
44
+ all hues at various levels of luminance, and does so for eight monotone bases
45
+ and eight accent colors (plus one zero chroma default base). Each of the
46
+ monotone base colors (named according to a natural biome whose colors they
47
+ loosely resemble) are designed to achieve identical contrast with the accents,
48
+ and thus any one of the options can be selected to change the feeling of
49
+ downstream themes without sacrificing readability.
50
+
51
+ ![Theme preview](images/repo_preview_primary.png)
52
+ _(Preview of light and dark alpine theme variants)_
53
+
54
+ The name "monobiome" connects the palette to its two key sources of
55
+ inspiration:
56
+
57
+ - `mono-`: `monobiome` is inspired by the [`monoindustrial` theme][1], and
58
+ attempts to extend and balance its accents while retaining similar color
59
+ identities.
60
+ - `-biome`: the desire for several distinct monotone options entailed finding a
61
+ way to ground the subtle color variations that were needed, and I liked the
62
+ idea of tying the choices to naturally occurring environmental variation like
63
+ Earth's biomes (even if it is a very loose affiliation, e.g., green-ish =
64
+ grass, basically).
65
+
66
+ ## Palette
67
+ The `monobiome` palette is fundamentally a set of parameterized curves in OKLCH
68
+ color space. Each color identity has one monotone curve and one accent curve,
69
+ both of which have fixed hue values and vary from 10% to 98% lightness.
70
+ Monotone curves have fixed chroma, whereas the accent curves' chroma varies
71
+ smoothly as a function of lightness within sRGB gamut bounds.
72
+
73
+ | Chroma curves | Color trajectories |
74
+ |---|---|
75
+ | ![Chroma curves](images/curves/cstar-curves-v140.png) | ![Trajectories](images/trajectories.gif) |
76
+
77
+ | Palette |
78
+ |---|
79
+ | ![Palette](images/palette.png) |
80
+
81
+ Chroma curves are designed specifically to establish a distinct role for each
82
+ accent and are non-intersecting over the lightness domain (hence the distinct
83
+ "bands" in the above chroma curve figure). There are eight monotone-accent
84
+ pairs, plus a single grey trajectory:
85
+
86
+ | Monotone / biome | Accent color | Hue |
87
+ | --- | --- | --- |
88
+ | alpine | grey | n/a |
89
+ | badlands | red | 29 |
90
+ | chaparral | orange | 62.5 |
91
+ | savanna | yellow | 104 |
92
+ | grassland | green | 148 |
93
+ | reef | cyan | 205 |
94
+ | tundra | blue | 262 |
95
+ | heathland | violet | 306 |
96
+ | moorland | magenta | 350 |
97
+
98
+ The `alpine`/`grey` curve has zero chroma (and is thus invariant to hue),
99
+ varying only in lightness from dark to light grey.
100
+
101
+ ## Themes
102
+
103
+ | Dark themes | Light themes |
104
+ |---|---|
105
+ | ![Dark themes](images/dark_themes.png) | ![Light themes](images/light_themes.png) |
106
+
107
+ Themes are derived from the `monobiome` palette by selecting a monotone base
108
+ (the "biome"), a base lightness, and a contrast level. Although one can use
109
+ arbitrary contrast metrics, OKLCH distance (Euclidean distance in OKLab)
110
+ is designed to capture perceptual distinction. As such, perceptually uniform
111
+ themes under arbitrary monotones can be generated by calculating the accent
112
+ colors equidistant from that base. This is equivalent to determining the points
113
+ at which a sphere centered at the monotone base intersects with the accent
114
+ curves; the radius of such a sphere effectively determines the theme contrast,
115
+ and the colors on the sphere surface are equally perceptually distinct relative
116
+ to the background.
117
+
118
+ The following plots show the intersection of the sphere centered at a fixed
119
+ background color (`alpine` biome with a lightness of 20) under variable radii:
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) |
125
+
126
+ In short, the base lightness (`-l`) dictates the brightness of the background,
127
+ and the contrast (`-d`) controls how perceptually distinct the accent colors
128
+ appear with respect to that background. These are free parameters of the
129
+ `monobiome` model: themes can be generated under arbitrary settings that meet
130
+ user preferences.
131
+
132
+ ## Generation
133
+ When generating full application themes, fixed lightness steps are used in the
134
+ chosen monotone trajectory to establish consistent levels of distinction
135
+ between background layers. For example, the following demonstrates how
136
+ background and foreground elements are chosen for the `monobiome` vim/neovim
137
+ themes:
138
+
139
+ ![
140
+ Diagram depicting how themes colors are selected by harshness and mapped onto
141
+ application-specific elements
142
+ ](images/vim_theme_elements.png)
143
+
144
+ Note how theme elements are mapped onto the general identifiers `bg0-bg3` for
145
+ backgrounds, `fg0-fg3` for foregrounds, and `gray` for a central gray tone. The
146
+ relative properties (lightness differences, contrast ratios) between colors
147
+ assigned to these identifiers are preserved regardless of biome or harshness
148
+ (e.g., `bg3` and `gray` are _always_ separated by 20 lightness points in any
149
+ theme). As a result, applying `monobiome` themes to specific applications can
150
+ effectively boil down to defining a single "relative template" that uses these
151
+ identifiers, after which any user-provided parameters can be applied
152
+ automatically.
153
+
154
+ The full palette $\rightarrow$ scheme $\rightarrow$ template $\rightarrow$
155
+ theme pipeline can be seen in detail below:
156
+
157
+ ![Generation pipeline](images/theme_generation_pipeline.png)
158
+
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:
162
+
163
+ - First generate the scheme file, the definitions that respect perceptual
164
+ uniformity of accents with respect to the base monotone:
165
+
166
+ ```sh
167
+ monobiome scheme dark grassland -d 0.42 -l 20 -o scheme.toml
168
+ ```
169
+
170
+ This calculates the accents a distance of `0.42` units in Oklab space from the
171
+ `grassland` monotone base at a lightness of `20`, and writes the output to
172
+ `scheme.toml`.
173
+ - Then populate the scheme file with concrete palette colors and push it
174
+ through an app config template:
175
+
176
+ ```sh
177
+ monobiome fill scheme.toml templates/kitty/active.theme -o kitty.theme
178
+ ```
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.
185
+
186
+ Running these commands in sequence from the repo root should work
187
+ out-of-the-box, after having installed the CLI tool.
188
+
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
+
194
+ ## Applications
195
+ This repo provides palette-agnostic theme templates for `kitty`,
196
+ `vim`/`neovim`, and `fzf` in the `templates/` directory. Pre-generated
197
+ *concrete* themes can be found in `app-config/`, if you'd like to try an
198
+ example out-of-the-box without using the `monobiome` CLI. Raw
199
+ palette colors can be found in `colors/` if you want to use them to define
200
+ static themes for other applications.
201
+
202
+ Themes files in the `app-config/` directory are generated for light and dark
203
+ modes of each biome, and named according to the following pattern:
204
+
205
+ ```sh
206
+ <biome>-monobiome-<mode>.<filename>
207
+ ```
208
+
209
+ One can set these themes for the provided applications as follows:
210
+
211
+ - `kitty`
212
+
213
+ Find `kitty` themes in `app-config/kitty`. Themes can be activated in your
214
+ `kitty.conf` with
215
+
216
+ ```sh
217
+ include <theme-file>
218
+ ```
219
+
220
+ Themes are generated using the [`kitty` theme
221
+ template](templates/apps/kitty/templates/active.theme).
222
+
223
+ - `vim`/`neovim`
224
+
225
+ Find `vim`/`neovim` themes in `app-config/nvim`. Themes can be activated by placing a
226
+ theme file on Vim's runtime path and setting it in your
227
+ `.vimrc`/`init.vim`/`init.lua`
228
+
229
+ with
230
+
231
+ ```sh
232
+ colorscheme <theme-name>
233
+ ```
234
+
235
+ Themes are generated using the [`vim` theme
236
+ template](templates/apps/nvim/templates/theme.vim).
237
+
238
+ - `fzf`
239
+
240
+ In `app-config/fzf`, you can find scripts that can be ran to export FZF theme
241
+ variables. In your shell config (e.g., `.bashrc` or `.zshrc`), you can source
242
+ these files to apply them in your terminal:
243
+
244
+ ```sh
245
+ source <theme-file>
246
+ ```
247
+
248
+ Themes are generated using the [`fzf` theme
249
+ template](templates/apps/fzf/templates/active.theme).
250
+
251
+ - Firefox
252
+
253
+ Firefox themes for all monotone backgrounds are publicly listed as [Mozilla
254
+ add-ons][2], and switch between light/dark schemes based on system settings.
255
+ You can also download raw XPI files for each theme in `app-config/firefox/`,
256
+ each of which is generated using the [Firefox `manifest.json`
257
+ template](templates/apps/firefox/templates/none-dark.manifest.json).
258
+
259
+ Static [light][4] and [dark][5] themes are additionally available (i.e., that
260
+ don't change with system settings).
261
+
262
+ ![Firefox theme previews](images/firefox/themes.png)
263
+
264
+ ## CLI installation
265
+ A brief theme generation guide was provided in the [Generation
266
+ section](#generation), making use of the `monobiome` CLI. This tool can be
267
+ installed from PyPI, using `uv`/`pipx`/similar:
268
+
269
+ ```sh
270
+ uv tool install monobiome
271
+ # or
272
+ pipx install monobiome
273
+ ```
274
+
275
+ The `monobiome` has provides three subcommands:
276
+
277
+ - `monobiome palette`: generate palette files from raw parameterized curves
278
+
279
+ ```
280
+ usage: monobiome palette [-h] [-n {hex,oklch}] [-f {json,toml}] [-o OUTPUT]
281
+
282
+ options:
283
+ -n {hex,oklch}, --notation {hex,oklch}
284
+ color notation to export (either hex or oklch)
285
+ -f {json,toml}, --format {json,toml}
286
+ format of palette file (either JSON or TOML)
287
+ -o OUTPUT, --output OUTPUT
288
+ output file to write palette content
289
+ ```
290
+
291
+ - `monobiome scheme`: generate scheme files that match perceptual parameters
292
+
293
+ ```
294
+ usage: monobiome scheme [-h] [-m {wcag,oklch,lightness}] [-d DISTANCE] [-o OUTPUT] [-l L_BASE]
295
+ [--l-step L_STEP] [--fg-gap FG_GAP] [--grey-gap GREY_GAP]
296
+ [--term-fg-gap TERM_FG_GAP]
297
+ {dark,light}
298
+ {alpine,badlands,chaparral,savanna,grassland,reef,tundra,heathland,moorland}
299
+
300
+ positional arguments:
301
+ {dark,light} scheme mode (light or dark)
302
+ {alpine,badlands,chaparral,savanna,grassland,reef,tundra,heathland,moorland}
303
+ biome setting for scheme.
304
+
305
+ options:
306
+ -m {wcag,oklch,lightness}, --metric {wcag,oklch,lightness}
307
+ metric to use for measuring swatch distances.
308
+ -d DISTANCE, --distance DISTANCE
309
+ distance threshold for specified metric
310
+ -o OUTPUT, --output OUTPUT
311
+ output file to write scheme content
312
+ -l L_BASE, --l-base L_BASE
313
+ minimum lightness level (default: 20)
314
+ --l-step L_STEP lightness step size (default: 5)
315
+ --fg-gap FG_GAP foreground lightness gap (default: 50)
316
+ --grey-gap GREY_GAP grey lightness gap (default: 30)
317
+ --term-fg-gap TERM_FG_GAP
318
+ terminal foreground lightness gap (default: 60)
319
+ ```
320
+
321
+ - `monobiome fill`: produce concrete application themes from a given scheme and
322
+ app template
323
+
324
+ ```
325
+ usage: monobiome fill [-h] [-p PALETTE] [-o OUTPUT] scheme [template]
326
+
327
+ positional arguments:
328
+ scheme scheme file path
329
+ template template file path (defaults to stdin)
330
+
331
+ options:
332
+ -p PALETTE, --palette PALETTE
333
+ palette file to use for color definitions
334
+ -o OUTPUT, --output OUTPUT
335
+ output file to write filled template
336
+ ```
337
+
338
+
339
+ [1]: https://github.com/isa/TextMate-Themes/blob/master/monoindustrial.tmTheme
340
+ [2]: https://addons.mozilla.org/en-US/firefox/collections/18495484/monobiome/
341
+ [3]: https://github.com/ologio/symconf
342
+ [4]: https://addons.mozilla.org/en-US/firefox/collections/18495484/monobiome-light/
343
+ [5]: https://addons.mozilla.org/en-US/firefox/collections/18495484/monobiome-dark/
@@ -0,0 +1,18 @@
1
+ monobiome/__init__.py,sha256=ChC5YFLK0kgvi0MJwD68LtZgUMJVCtNbtY32UQTvdA4,75
2
+ monobiome/__main__.py,sha256=4K-CQWWiSXQbXgNLPqdOts6R3wOJeDJ0ygSARPI-eiA,439
3
+ monobiome/constants.py,sha256=w4H9V2Tp2ZK3ddcjtBdDtokZdj2Y1ssW3RSopxqP7rw,3105
4
+ monobiome/curve.py,sha256=4IMn-YksJrqMOR-oYjA9oIJChI_Hz11AmynhYjLXl48,1754
5
+ monobiome/palette.py,sha256=EhB90k1XINzbCxU8bBWc_fnEtbOXoJYfwAbtyx1nG-g,1505
6
+ monobiome/plotting.py,sha256=HM_na2K2TUPdu_Ey0v-2AD5DF0F9kSX3VB4y3Yp_788,5549
7
+ monobiome/scheme.py,sha256=5AwQW5Ibs-B7ZahGSXSmTE7CFZUpk3SKN42Qo-EW2AM,7793
8
+ monobiome/util.py,sha256=qHLC-azOgslJcW1tNNX5TVeG3RPGpleUO2s9Nu1rbjY,1068
9
+ monobiome/cli/__init__.py,sha256=bs2ZJZSWNg5tuxzAMzRzyB25Lbc4PDCVbrF2IKl2lK8,819
10
+ monobiome/cli/fill.py,sha256=FbDpUZJegCUatFxPRk8hp4z2V93WBwqHPCOpw3rzJR4,2116
11
+ monobiome/cli/palette.py,sha256=7eIHVt6Oj4YqbIiVbcIY7w97FHTpuQYRWtINXc0vxtw,1265
12
+ monobiome/cli/scheme.py,sha256=gTYBFM-4vRgh3WnHSUB8iWUzhvTbltTCdOPPuvpOS7E,3771
13
+ monobiome/data/parameters.toml,sha256=7ru0j_1G5rNFWc7AFKSHJUpyL_I2qdZYeDFt6q5wtQw,801
14
+ monobiome-1.5.0.dist-info/METADATA,sha256=GsBUxBj_sPhPbBfxwhQ0tzYGuBbQafVgiB0CRLgvRDw,13848
15
+ monobiome-1.5.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
+ monobiome-1.5.0.dist-info/entry_points.txt,sha256=LpqkPxdTacTY_TaRn8eczICmPbVlXdRSoMqaxSfVxh4,54
17
+ monobiome-1.5.0.dist-info/top_level.txt,sha256=ZA2wgRkPoG4xG0rSjyHKkuG8cdSHRr1U_DcrplXoi3A,10
18
+ monobiome-1.5.0.dist-info/RECORD,,
@@ -1,231 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: monobiome
3
- Version: 1.3.1
4
- Summary: Monobiome color palette
5
- Project-URL: Homepage, https://doc.olog.io/monobiome
6
- Project-URL: Documentation, https://doc.olog.io/monobiome
7
- Project-URL: Repository, https://git.olog.io/olog/monobiome
8
- Project-URL: Issues, https://git.olog.io/olog/monobiome/issues
9
- Requires-Python: >=3.12
10
- Description-Content-Type: text/markdown
11
- Requires-Dist: coloraide>=5.1
12
- Requires-Dist: imageio[ffmpeg]>=2.37.2
13
- Requires-Dist: ipython>=9.6.0
14
- Requires-Dist: kaleido>=1.1.0
15
- Requires-Dist: matplotlib>=3.10.7
16
- Requires-Dist: nbformat>=5.10.4
17
- Requires-Dist: numpy>=2.3.4
18
- Requires-Dist: pillow>=12.0.0
19
- Requires-Dist: plotly>=6.3.1
20
- Requires-Dist: scipy>=1.16.2
21
-
22
- # Monobiome
23
- `monobiome` is a minimal, balanced color palette for use in terminals and text
24
- editors. It was designed in OKLCH space to achieve perceptual uniformity across
25
- all hues at various levels of luminance, and does so for _five_ monotone bases
26
- and _five_ accent colors (plus one gray "default"). Each of the monotone base
27
- colors (named according to a natural biome whose colors they loosely resemble)
28
- are designed to achieve identical contrast with the accents, and thus any one
29
- of the options can be selected to change the feeling of the palette without
30
- sacrificing readability.
31
-
32
- ![Theme preview](images/repo_preview_four_split.png)
33
- _(Preview of default light and dark theme variants)_
34
-
35
- See screenshots for the full set of theme variants in [THEMES](THEMES.md) (also
36
- discussed below).
37
-
38
- The name "monobiome" connects the palette to its two key sources of
39
- inspiration:
40
-
41
- - `mono-`: `monobiome` is inspired by the [`monoindustrial` theme][1], and
42
- attempts to extend and balance its accents while retaining similar color
43
- identities.
44
- - `-biome`: the desire for several distinct monotone options entailed finding a
45
- way to ground the subtle color variations that were needed, and I liked the
46
- idea of tying the choices to naturally occurring environmental variation like
47
- Earth's biomes (even if it is a very loose affiliation, e.g., green-ish =
48
- grass, basically).
49
-
50
- ## Palette
51
- The `monobiome` palette consists of four monotone bases and five accent colors,
52
- each of which is anchored by hue and spread uniformly across lightness levels
53
- 15 to 95 (in OKLCH space).
54
-
55
- ![Diagram of palette accents and monotones](images/palette.png)
56
-
57
- The chroma curve for each accent is carefully designed to vary smoothly across
58
- the lightness spectrum, with the goal of retaining strong color identity in all
59
- settings. Additionally, as alluded to above, the (WCAG 2) contrast ratio
60
- between any choice of monotone background at a given lightness level and the
61
- accent colors is virtually identical ($\pm 0.1$). Put another way, the relative
62
- contrast between accents depends only on the _lightness_ of the background
63
- monotone, not its hue. *(Note that this is not generally the case; at a fixed
64
- lightness level, the contrast between two colors depends on their hue.)*
65
-
66
- ## Concrete themes
67
-
68
- ![Split view of Alpine and Tundra biomes](images/theme-split-view.png)
69
-
70
- *(Light and dark theme splits of Alpine and Tundra biomes)*
71
-
72
- Themes are derived from the `monobiome` palette by varying both the monotone
73
- hue (the "biome") and the extent of the background/foreground lightness (the
74
- "harshness"). This is done for both light and dark schemes, and in each case
75
- accent colors are selected at a lightness level that ensures each meet a
76
- minimum contrast relative to the primary background. The following diagram
77
- shows each of the 36 resulting combinations:
78
-
79
- ![Diagram of the 36 available concrete theme options](images/themes.png)
80
-
81
- The "soft" harshness level uses monotone shades closer to the mid-shade
82
- (lightness level 55), whereas "hard" harshness uses shades further from it.
83
- Once the biome and harshness level are chosen, we're left with a bounded
84
- monotone range over which common theme elements can be defined. For example,
85
- the following demonstrates how background and foreground elements are chosen
86
- for the `monobiome` Vim themes:
87
-
88
- ![
89
- Diagram depicting how themes colors are selected by harshness and mapped onto
90
- application-specific elements
91
- ](images/vim_theme_elements.png)
92
-
93
- Note how theme elements are mapped onto the general identifiers `bg0-bg3` for
94
- backgrounds, `fg0-fg3` for foregrounds, and `gray` for a central gray tone. The
95
- relative properties (lightness differences, contrast ratios) between colors
96
- assigned to these identifiers are preserved regardless of biome or harshness
97
- (e.g., `bg3` and `gray` are _always_ separated by 20 lightness points in any
98
- theme). As a result, applying `monobiome` themes to specific applications can
99
- effectively boil down to defining a single "relative template" that uses these
100
- identifiers, after which any of the 36 theme options can applied immediately.
101
-
102
- Read more about how themes are created in [DESIGN](DESIGN.md).
103
-
104
- # Usage
105
- This repo provides the 36 theme files for `kitty`, `vim`/`neovim`, and `fzf` in
106
- the `app-config/` directory. You can also find raw palette colors in
107
- `colors/monobiome.toml` if you want to use them to define themes for other
108
- applications.
109
-
110
- Each of the files in the `app-config/` directory are named according to
111
-
112
- ```sh
113
- <harshness>-<biome>-monobiome-<mode>.<ext>
114
- ```
115
-
116
- For example, `monobiome-tundra-dark-soft.vim` is the Vim theme file for the
117
- dark `tundra` variant with the soft harshness level.
118
-
119
- ## Applications
120
- - `kitty`
121
-
122
- Find `kitty` themes in `app-config/kitty`. Themes can be activated in your
123
- `kitty.conf` with
124
-
125
- ```sh
126
- include <theme-file>
127
- ```
128
-
129
- Themes are generated using the [`kitty` theme
130
- template](templates/apps/kitty/templates/active.theme).
131
-
132
- - `vim`/`neovim`
133
-
134
- Find `vim`/`neovim` themes in `app-config/nvim`. Themes can be activated by placing a
135
- theme file on Vim's runtime path and setting it in your `.vimrc`/`init.vim`
136
- with
137
-
138
- ```sh
139
- colorscheme <theme-name>
140
- ```
141
-
142
- Themes are generated using the [`vim` theme
143
- template](templates/apps/nvim/templates/theme.vim).
144
-
145
- - `fzf`
146
-
147
- In `app-config/fzf`, you can find scripts that can be ran to export FZF theme
148
- variables. In your shell config (e.g., `.bashrc` or `.zshrc`), you can source
149
- these files to apply them in your terminal:
150
-
151
- ```sh
152
- source <theme-file>
153
- ```
154
-
155
- Themes are generated using the [`fzf` theme
156
- template](templates/apps/fzf/templates/active.theme).
157
-
158
- - Firefox
159
-
160
- Firefox themes for all monotone backgrounds are publicly listed as [Mozilla
161
- add-ons][2], and switch between light/dark schemes based on system settings.
162
- You can also download raw XPI files for each theme in `app-config/firefox/`,
163
- each of which is generated using the [Firefox `manifest.json`
164
- template](templates/apps/firefox/templates/none-dark.manifest.json).
165
-
166
- Static [light][4] and [dark][5] are additionally available.
167
-
168
- ![Firefox theme previews](images/firefox/themes.png)
169
-
170
- # Switching themes
171
- [`symconf`][3] is a general-purpose application config manager that can be used
172
- to generate all `monobiome` variants from a single palette file, and set themes
173
- for all apps at once. You can find example theme templates in
174
- `templates/groups/theme`, which provide general theme variables you can use in
175
- your own config templates.
176
-
177
- For instance, in an app like `kitty`, you can define a template like
178
-
179
- ```conf
180
- # base settings
181
- background f{{theme.term.background}}
182
- foreground f{{theme.term.foreground}}
183
-
184
- selection_background f{{theme.term.selection_bg}}
185
- selection_foreground f{{theme.term.selection_fg}}
186
-
187
- cursor f{{theme.term.cursor}}
188
- cursor_text_color f{{theme.term.cursor_text_color}}
189
-
190
- # black
191
- color0 f{{theme.term.normal.black}}
192
- color8 f{{theme.term.bright.black}}
193
-
194
- # red
195
- color1 f{{theme.term.normal.red}}
196
- color9 f{{theme.term.bright.red}}
197
-
198
- # green
199
- color2 f{{theme.term.normal.green}}
200
- color10 f{{theme.term.bright.green}}
201
-
202
- # yellow
203
- color3 f{{theme.term.normal.yellow}}
204
- color11 f{{theme.term.bright.yellow}}
205
-
206
- # blue
207
- color4 f{{theme.term.normal.blue}}
208
- color12 f{{theme.term.bright.blue}}
209
-
210
- # purple (red)
211
- color5 f{{theme.term.normal.purple}}
212
- color13 f{{theme.term.bright.purple}}
213
-
214
- # cyan (blue)
215
- color6 f{{theme.term.normal.cyan}}
216
- color14 f{{theme.term.bright.cyan}}
217
-
218
- ## white
219
- color7 f{{theme.term.normal.white}}
220
- color15 f{{theme.term.bright.white}}
221
- ```
222
-
223
- and use `symconf` to dynamically fill these variables based on a selected
224
- biome/harshness/mode. This can be done for any app config file.
225
-
226
-
227
- [1]: https://github.com/isa/TextMate-Themes/blob/master/monoindustrial.tmTheme
228
- [2]: https://addons.mozilla.org/en-US/firefox/collections/18495484/monobiome/
229
- [3]: https://github.com/ologio/symconf
230
- [4]: https://addons.mozilla.org/en-US/firefox/collections/18495484/monobiome-light/
231
- [5]: https://addons.mozilla.org/en-US/firefox/collections/18495484/monobiome-dark/
@@ -1,17 +0,0 @@
1
- monobiome/__init__.py,sha256=ChC5YFLK0kgvi0MJwD68LtZgUMJVCtNbtY32UQTvdA4,75
2
- monobiome/__main__.py,sha256=k2Pu_FeAsW_wnE55Y-JJaRP_GgxAZEjW3z_Kmk3O8C8,431
3
- monobiome/constants.py,sha256=w4H9V2Tp2ZK3ddcjtBdDtokZdj2Y1ssW3RSopxqP7rw,3105
4
- monobiome/curve.py,sha256=tw44OoRGDSxTzljxJkgifWhCTEj05TBYnw4jOdrNgfA,1748
5
- monobiome/palette.py,sha256=fReZD1Aa7xOKQQgnYB8qRxszZy1nq9XLqjUIblENsvI,1489
6
- monobiome/plotting.py,sha256=1eAJY-0PLtq2r4ZHYCY3YYnVlCVu7PXteAcs1zV4irY,4679
7
- monobiome/scheme.py,sha256=CFP_WqTk-CwbgpVt2E_TczC9cZymAh_lqbkWmN4AsOg,7541
8
- monobiome/util.py,sha256=qHLC-azOgslJcW1tNNX5TVeG3RPGpleUO2s9Nu1rbjY,1068
9
- monobiome/cli/__init__.py,sha256=wtBhzdyyRy0-WM4fUpDESJBiedYy8MbwousVCdangUE,774
10
- monobiome/cli/palette.py,sha256=i3baWZs4Sverbd79YMBPYnH0P2rT0i7z3ZAtO_UBWNw,1219
11
- monobiome/cli/scheme.py,sha256=CkwtGBCPUEPt2TnK_WDQBg8TKTw_hjGoQtbjjBlNmH0,3725
12
- monobiome/data/parameters.toml,sha256=7ru0j_1G5rNFWc7AFKSHJUpyL_I2qdZYeDFt6q5wtQw,801
13
- monobiome-1.3.1.dist-info/METADATA,sha256=n_gLP_F0ghbpq3eco0ULz37Lmc1GnhFhsIPgHGnhNn0,8947
14
- monobiome-1.3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
- monobiome-1.3.1.dist-info/entry_points.txt,sha256=LpqkPxdTacTY_TaRn8eczICmPbVlXdRSoMqaxSfVxh4,54
16
- monobiome-1.3.1.dist-info/top_level.txt,sha256=ZA2wgRkPoG4xG0rSjyHKkuG8cdSHRr1U_DcrplXoi3A,10
17
- monobiome-1.3.1.dist-info/RECORD,,