Skip to main content

max / alloy

install: draw the console frame in colors the terminal has Depends on alloy_tui 1.1.0, which resolves a theme to what the terminal can draw before handing it over. On the Linux console, where the installer runs and where a freshly installed machine's tty lives, colors are now sent as palette indices rather than as 24-bit the console approximates for itself. The installer's frame and title, invisible until now because the console collapsed them into the page, are drawn in an index kept distinct from it.
Author: Max Johnson <me@maxj.phd> · 2026-07-21 21:55 UTC
Signed with PGP, not checked
Commit: 8be89934b5b3f4adadafed1a4d25a417abeb0eb2
Parent: b37fb48
3 files changed, +18 insertions, -71 deletions
M Cargo.lock +10 -69
@@ -30,14 +30,14 @@
30 30 "serde",
31 31 "serde_json",
32 32 "sha-crypt",
33 - "toml 1.1.3+spec-1.1.0",
33 + "toml",
34 34 ]
35 35
36 36 [[package]]
37 37 name = "alloy_tui"
38 - version = "1.0.0"
38 + version = "1.1.0"
39 39 source = "registry+https://github.com/rust-lang/crates.io-index"
40 - checksum = "c0982d8c72496a71b7aa87b113e6777d4829ea8a15a0ee4dda97e2b922e1dbf2"
40 + checksum = "a0dce987e054875390687b1f3bbe547095d866d4fdf18dbd313f65a444c45d44"
41 41 dependencies = [
42 42 "makeover",
43 43 "ratatui",
@@ -809,13 +809,13 @@
809 809
810 810 [[package]]
811 811 name = "makeover"
812 - version = "1.0.0"
812 + version = "1.1.0"
813 813 source = "registry+https://github.com/rust-lang/crates.io-index"
814 - checksum = "15a1acf8af277255389ab1d7e53412e442983886413025c2f32f9d1dbde81d33"
814 + checksum = "9226bc7482aa9280499322df2be034f303dfcd3d697581375a42fcd95abeb62c"
815 815 dependencies = [
816 816 "include_dir",
817 817 "serde",
818 - "toml 0.8.23",
818 + "toml",
819 819 ]
820 820
821 821 [[package]]
@@ -1343,15 +1343,6 @@
1343 1343 "zmij",
1344 1344 ]
1345 1345
1346 - [[package]]
1347 - name = "serde_spanned"
1348 - version = "0.6.9"
1349 - source = "registry+https://github.com/rust-lang/crates.io-index"
1350 - checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3"
1351 - dependencies = [
1352 - "serde",
1353 - ]
1354 -
1355 1346 [[package]]
1356 1347 name = "serde_spanned"
1357 1348 version = "1.1.1"
@@ -1635,18 +1626,6 @@
1635 1626 source = "registry+https://github.com/rust-lang/crates.io-index"
1636 1627 checksum = "8b36ee98fd31ec7426d599183e8fe26932a8dc1fb76ddb6214d05493377d34ca"
1637 1628
1638 - [[package]]
1639 - name = "toml"
1640 - version = "0.8.23"
1641 - source = "registry+https://github.com/rust-lang/crates.io-index"
1642 - checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
1643 - dependencies = [
1644 - "serde",
1645 - "serde_spanned 0.6.9",
1646 - "toml_datetime 0.6.11",
1647 - "toml_edit",
1648 - ]
1649 -
1650 1629 [[package]]
1651 1630 name = "toml"
1652 1631 version = "1.1.3+spec-1.1.0"
@@ -1655,20 +1634,11 @@
1655 1634 dependencies = [
1656 1635 "indexmap",
1657 1636 "serde_core",
1658 - "serde_spanned 1.1.1",
1659 - "toml_datetime 1.1.1+spec-1.1.0",
1637 + "serde_spanned",
1638 + "toml_datetime",
1660 1639 "toml_parser",
1661 1640 "toml_writer",
1662 - "winnow 1.0.4",
1663 - ]
1664 -
1665 - [[package]]
1666 - name = "toml_datetime"
1667 - version = "0.6.11"
1668 - source = "registry+https://github.com/rust-lang/crates.io-index"
1669 - checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"
1670 - dependencies = [
1671 - "serde",
1641 + "winnow",
1672 1642 ]
1673 1643
1674 1644 [[package]]
@@ -1680,35 +1650,15 @@
1680 1650 "serde_core",
1681 1651 ]
1682 1652
1683 - [[package]]
1684 - name = "toml_edit"
1685 - version = "0.22.27"
1686 - source = "registry+https://github.com/rust-lang/crates.io-index"
1687 - checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
1688 - dependencies = [
1689 - "indexmap",
1690 - "serde",
1691 - "serde_spanned 0.6.9",
1692 - "toml_datetime 0.6.11",
1693 - "toml_write",
1694 - "winnow 0.7.15",
1695 - ]
1696 -
1697 1653 [[package]]
1698 1654 name = "toml_parser"
1699 1655 version = "1.1.2+spec-1.1.0"
1700 1656 source = "registry+https://github.com/rust-lang/crates.io-index"
1701 1657 checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526"
1702 1658 dependencies = [
1703 - "winnow 1.0.4",
1659 + "winnow",
1704 1660 ]
1705 1661
1706 - [[package]]
1707 - name = "toml_write"
1708 - version = "0.1.2"
1709 - source = "registry+https://github.com/rust-lang/crates.io-index"
1710 - checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
1711 -
1712 1662 [[package]]
1713 1663 name = "toml_writer"
1714 1664 version = "1.1.2+spec-1.1.0"
@@ -1958,15 +1908,6 @@
1958 1908 "windows-link",
1959 1909 ]
1960 1910
1961 - [[package]]
1962 - name = "winnow"
1963 - version = "0.7.15"
1964 - source = "registry+https://github.com/rust-lang/crates.io-index"
1965 - checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"
1966 - dependencies = [
1967 - "memchr",
1968 - ]
1969 -
1970 1911 [[package]]
1971 1912 name = "winnow"
1972 1913 version = "1.0.4"
@@ -13,7 +13,7 @@
13 13 path = "src/main.rs"
14 14
15 15 [dependencies]
16 - alloy_tui = "1.0.0"
16 + alloy_tui = "1.1.0"
17 17 anyhow = "1"
18 18 clap = { version = "4", features = ["derive"] }
19 19 ratatui.workspace = true
@@ -65,7 +65,13 @@
65 65 format!("loading theme `{id}` (searched: {})", searched.join(", "))
66 66 })?;
67 67
68 - Theme::from_theme(&colors).with_context(|| format!("theme `{id}` is incomplete"))
68 + // Resolved to what this terminal can draw, not just to what the theme
69 + // says. The installer runs on the Linux virtual console, which has sixteen
70 + // colors and approximates anything else it is sent; the console's own
71 + // approximation collapsed the frame into the page behind it.
72 + Theme::from_theme(&colors)
73 + .map(|theme| theme.for_terminal(alloy_tui::detect_color_depth()))
74 + .with_context(|| format!("theme `{id}` is incomplete"))
69 75 }
70 76
71 77 /// Guess whether the terminal is dark, and pick the matching Akari default.