Skip to content

Commit c4b0243

Browse files
committed
Add VHS-based demo GIF recording and show both themes in README
Record demo GIFs using VHS (xterm.js via headless Chromium), which renders Unicode fractional block characters algorithmically instead of via font glyph outlines. Uses zenwritten dark/light themes for good ANSI color contrast. Both demos shown side by side in the README.
1 parent 8c54840 commit c4b0243

File tree

5 files changed

+81
-8
lines changed

5 files changed

+81
-8
lines changed

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ bin/cli.js CLI entry point, flag routing, --install/--uninstall
99
lib/statusline.js Core: stdin parsing, OAuth, usage API, git info, bar rendering
1010
lib/demo.js --demo animation (sawtooth waves, standalone)
1111
config.example.json JSONC example with all 4 gradient combos
12-
assets/ demo.cast (asciinema) and demo.gif
12+
assets/ demo-dark.gif and demo-light.gif (recorded via VHS)
1313
```
1414

1515
## How the statusline protocol works

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
Pixel-perfect progress bars for your Claude Code statusline. See how much context and usage you have left at a glance.
99

10-
![Demo](./assets/demo.gif)
10+
| Dark | Light |
11+
|---|---|
12+
| ![Dark mode demo](./assets/demo-dark.gif) | ![Light mode demo](./assets/demo-light.gif) |
1113

1214
## What you get
1315

@@ -19,7 +21,7 @@ Three bars with sub-cell precision using Unicode fractional block characters:
1921
| 5-hour usage | Rolling rate limit utilization | Time until reset, git branch/changes, lines added/removed |
2022
| Weekly usage | Rolling 7-day rate limit utilization | Time until reset, current directory |
2123

22-
Bars shift green → yellow → orange → red as usage increases. Stale data (API unreachable) is prefixed with `~`. Works with Pro, Max 5x, Max 20x, and Team subscriptions. API key users see an "API" label with context bar only.
24+
Bars shift green to red as usage increases. Stale data (API unreachable) is prefixed with `~`. Works with Pro, Max 5x, Max 20x, and Team subscriptions. API key users see an "API" label with context bar only.
2325

2426
## Install
2527

@@ -37,7 +39,7 @@ howmuchleft --install ~/.claude-personal
3739

3840
## Configuration
3941

40-
Config file: `~/.config/howmuchleft.json` (JSONC comments and trailing commas are allowed).
42+
Config file: `~/.config/howmuchleft.json` (JSONC -- comments and trailing commas are allowed).
4143

4244
```jsonc
4345
{
@@ -56,7 +58,7 @@ Config file: `~/.config/howmuchleft.json` (JSONC — comments and trailing comma
5658

5759
| Field | Default | Description |
5860
|---|---|---|
59-
| `progressLength` | `12` | Bar width in characters (340) |
61+
| `progressLength` | `12` | Bar width in characters (3--40) |
6062
| `colorMode` | `"auto"` | `"auto"` (detect via `COLORTERM`), `"truecolor"`, or `"256"` |
6163
| `colors` | built-in | Array of color entries (see below) |
6264

@@ -66,12 +68,12 @@ Each entry in the `colors` array is matched against the current terminal. First
6668

6769
| Field | Required | Description |
6870
|---|---|---|
69-
| `gradient` | Yes | Color stops: `[R,G,B]` arrays for truecolor, or integers (0255) for 256-color |
70-
| `bg` | No | Empty bar background: `[R,G,B]` for truecolor, or integer (0255) for 256-color |
71+
| `gradient` | Yes | Color stops: `[R,G,B]` arrays for truecolor, or integers (0--255) for 256-color |
72+
| `bg` | No | Empty bar background: `[R,G,B]` for truecolor, or integer (0--255) for 256-color |
7173
| `dark-mode` | No | Match dark (`true`) or light (`false`) terminals only |
7274
| `true-color` | No | Match truecolor (`true`) or 256-color (`false`) terminals only |
7375

74-
Truecolor gradients are smoothly interpolated between stops 3 stops (green, yellow, red) is enough for a smooth bar. 256-color gradients snap to the nearest stop.
76+
Truecolor gradients are smoothly interpolated between stops -- 3 stops (green, yellow, red) is enough for a smooth bar. 256-color gradients snap to the nearest stop.
7577

7678
To preview your current gradient: `howmuchleft --test-colors`
7779

assets/demo-dark.gif

1.81 MB
Loading

assets/demo-light.gif

1.82 MB
Loading

scripts/record-gif.sh

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/usr/bin/env bash
2+
# Record demo GIFs for both dark and light modes using VHS.
3+
#
4+
# Usage: ./scripts/record-gif.sh [duration_seconds]
5+
# Output: assets/demo-dark.gif, assets/demo-light.gif
6+
#
7+
# Prerequisites:
8+
# - vhs (go install github.com/charmbracelet/vhs@latest)
9+
# - ffmpeg
10+
# - ttyd (https://github.com/tsl0922/ttyd/releases)
11+
12+
set -euo pipefail
13+
14+
DURATION="${1:-15}"
15+
16+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
17+
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
18+
ASSETS_DIR="$PROJECT_DIR/assets"
19+
20+
mkdir -p "$ASSETS_DIR"
21+
22+
record_gif() {
23+
local mode="$1"
24+
local dark_val theme
25+
26+
if [ "$mode" = "dark" ]; then
27+
dark_val=1
28+
theme="zenwritten_dark"
29+
else
30+
dark_val=0
31+
theme="zenwritten_light"
32+
fi
33+
34+
local gif_file="$ASSETS_DIR/demo-${mode}.gif"
35+
local tape_file="$ASSETS_DIR/.demo-${mode}.tape"
36+
37+
# Generate tape file for VHS
38+
cat > "$tape_file" <<TAPE
39+
Output "${gif_file}"
40+
Set FontSize 36
41+
Set FontFamily "Adwaita Mono"
42+
Set Height 250
43+
Set Width 1400
44+
Set Padding 20
45+
Set Framerate 30
46+
Set Theme "${theme}"
47+
Env COLORTERM "truecolor"
48+
Env HOWMUCHLEFT_DARK "${dark_val}"
49+
Hide
50+
Type "node ${PROJECT_DIR}/bin/cli.js --demo ${DURATION}"
51+
Enter
52+
Sleep 500ms
53+
Show
54+
Sleep ${DURATION}s
55+
TAPE
56+
57+
echo "Recording $mode mode demo (${DURATION}s)..."
58+
vhs "$tape_file"
59+
60+
# Clean up tape file
61+
rm -f "$tape_file"
62+
63+
local size
64+
size=$(du -h "$gif_file" | cut -f1)
65+
echo " -> $gif_file ($size)"
66+
}
67+
68+
record_gif dark
69+
record_gif light
70+
71+
echo "Done."

0 commit comments

Comments
 (0)