Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

Commit 690336b

Browse files
committed
some colours
1 parent 3556746 commit 690336b

2 files changed

Lines changed: 14 additions & 20 deletions

File tree

apps/cli/src/commands/log.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import {
99
blue,
1010
cyan,
1111
dim,
12+
formatChangeId,
13+
formatCommitId,
1214
green,
1315
hint,
1416
magenta,
@@ -432,8 +434,10 @@ function renderEnhancedOutput(
432434
}
433435
pendingHints = [];
434436
}
435-
// Add blank line after commit
436-
output.push("│");
437+
// Add blank line after commit, preserving graph structure
438+
// Extract just the graph connectors from prefix (│, ├, etc.)
439+
const blankLinePrefix = prefix.replace(/[^\s]/g, " ").trimEnd();
440+
output.push(blankLinePrefix || "│");
437441
break;
438442
}
439443
}
@@ -545,22 +549,6 @@ function buildPRInfoMap(
545549
return prInfoMap;
546550
}
547551

548-
function formatChangeId(changeId: string, prefix: string): string {
549-
const short = changeId.slice(0, 8);
550-
if (prefix && short.startsWith(prefix)) {
551-
return magenta(prefix) + dim(short.slice(prefix.length));
552-
}
553-
return magenta(short);
554-
}
555-
556-
function formatCommitId(commitId: string, prefix: string): string {
557-
const short = commitId.slice(0, 8);
558-
if (prefix && short.startsWith(prefix)) {
559-
return cyan(prefix) + dim(short.slice(prefix.length));
560-
}
561-
return cyan(short);
562-
}
563-
564552
function formatPRLine(prInfo: PRInfo): string {
565553
const stateColor =
566554
prInfo.state === "MERGED" ? magenta : prInfo.state === "OPEN" ? green : red;

apps/cli/src/utils/output.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ const colors = {
1414
white: "\x1b[37m",
1515
pink: "\x1b[1;95m",
1616
brightBlue: "\x1b[1;94m",
17+
// jj-style 256 colors
18+
jjChangeId: "\x1b[38;5;5m", // magenta (256-color)
19+
jjChangeIdBright: "\x1b[1m\x1b[38;5;13m", // bright magenta (for WC)
20+
jjCommitId: "\x1b[38;5;4m", // blue (256-color)
21+
jjCommitIdBright: "\x1b[1m\x1b[38;5;12m", // bright blue (for WC)
22+
jjGray: "\x1b[38;5;8m", // gray for suffixes
1723
};
1824

1925
export function red(text: string): string {
@@ -58,12 +64,12 @@ export function dim(text: string): string {
5864

5965
export function formatChangeId(fullId: string, prefix: string): string {
6066
const rest = fullId.slice(prefix.length);
61-
return `${pink(prefix)}${dim(rest)}`;
67+
return `${colors.jjChangeId}${prefix}${colors.jjGray}${rest}${colors.reset}`;
6268
}
6369

6470
export function formatCommitId(fullId: string, prefix: string): string {
6571
const rest = fullId.slice(prefix.length);
66-
return `${colors.brightBlue}${prefix}${colors.reset}${dim(rest)}`;
72+
return `${colors.brightBlue}${prefix}${colors.reset}${colors.jjGray}${rest}${colors.reset}`;
6773
}
6874

6975
export function formatError(error: unknown): string {

0 commit comments

Comments
 (0)