Skip to content

Commit 6506135

Browse files
authored
fix(prompts): style box guide bar to match other gutters (#588)
1 parent dc5bce8 commit 6506135

4 files changed

Lines changed: 172 additions & 149 deletions

File tree

‎.changeset/box-guide-colour.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@clack/prompts": patch
3+
---
4+
5+
Style the guide bar rendered by `box({ withGuide: true })` in grey so it matches the gutter drawn by `log`, `note` and the spinner

‎packages/prompts/src/box.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { Writable } from 'node:stream';
2+
import { styleText } from 'node:util';
23
import { getColumns, settings } from '@clack/core';
34
import stringWidth from 'fast-string-width';
45
import { wrapAnsi } from 'fast-wrap-ansi';
@@ -129,7 +130,7 @@ export const box = (message = '', title = '', opts?: BoxOptions) => {
129130
const contentPadding = opts?.contentPadding ?? 2;
130131
const width = opts?.width === undefined || opts.width === 'auto' ? 1 : Math.min(1, opts.width);
131132
const hasGuide = opts?.withGuide ?? settings.withGuide;
132-
const linePrefix = !hasGuide ? '' : `${S_BAR} `;
133+
const linePrefix = !hasGuide ? '' : `${styleText('gray', S_BAR)} `;
133134
const formatBorder = opts?.formatBorder ?? defaultFormatBorder;
134135
const symbols = (opts?.rounded ? roundedSymbols : squareSymbols).map(formatBorder);
135136
const hSymbol = formatBorder(S_BAR_H);

0 commit comments

Comments
 (0)