Skip to content

Commit 96694b0

Browse files
authored
Merge pull request #55 from ryanbas21/chore/fix-effect-subtree
chore: re-initialize repos/effect/ as proper git subtree
2 parents b39de28 + e76cb10 commit 96694b0

3 files changed

Lines changed: 25 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@effect/cli": patch
3+
---
4+
5+
Fix `@effect/cli` help output to use `Ansi.blackBright` instead of `Ansi.black` for `Weak` spans. The previous black foreground was invisible on dark terminal backgrounds.

repos/effect/packages/cli/src/internal/helpDoc/span.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export const toAnsiDoc = (self: Span.Span): Doc.AnsiDoc => {
139139
return Doc.annotate(Doc.text(self.value), Ansi.underlined)
140140
}
141141
case "Weak": {
142-
return Doc.annotate(toAnsiDoc(self.value), Ansi.black)
142+
return Doc.annotate(toAnsiDoc(self.value), Ansi.blackBright)
143143
}
144144
}
145145
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import * as HelpDoc from "@effect/cli/HelpDoc"
2+
import * as Span from "@effect/cli/HelpDoc/Span"
3+
import * as AnsiDoc from "@effect/printer-ansi/AnsiDoc"
4+
import { describe, expect, it } from "@effect/vitest"
5+
6+
describe("HelpDoc", () => {
7+
describe("toAnsiDoc", () => {
8+
it("Weak spans use bright black (dark gray), not black, so they are readable on dark terminals", () => {
9+
const span = Span.weak("name")
10+
const ansiDoc = HelpDoc.toAnsiDoc(HelpDoc.p(span))
11+
const rendered = AnsiDoc.render(ansiDoc, { style: "pretty" })
12+
// ANSI foreground code 30 = black — invisible on dark/black terminal backgrounds.
13+
// Weak spans must not produce this code.
14+
// String.fromCharCode(27) = ESC; avoids no-control-regex on both regex literals and new RegExp().
15+
const ESC = String.fromCharCode(27)
16+
expect(rendered).not.toMatch(new RegExp(ESC + "\\[[0-9;]*30[;m]"))
17+
})
18+
})
19+
})

0 commit comments

Comments
 (0)