Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-cli-weak-span-dark-terminal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@effect/cli": patch
---

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.
2 changes: 1 addition & 1 deletion packages/cli/src/internal/helpDoc/span.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export const toAnsiDoc = (self: Span.Span): Doc.AnsiDoc => {
return Doc.annotate(Doc.text(self.value), Ansi.underlined)
}
case "Weak": {
return Doc.annotate(toAnsiDoc(self.value), Ansi.black)
return Doc.annotate(toAnsiDoc(self.value), Ansi.blackBright)
}
}
}
17 changes: 17 additions & 0 deletions packages/cli/test/HelpDoc.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import * as HelpDoc from "@effect/cli/HelpDoc"
import * as Span from "@effect/cli/HelpDoc/Span"
import * as AnsiDoc from "@effect/printer-ansi/AnsiDoc"
import { describe, expect, it } from "@effect/vitest"

describe("HelpDoc", () => {
describe("toAnsiDoc", () => {
it("Weak spans use bright black (dark gray), not black, so they are readable on dark terminals", () => {
const span = Span.weak("name")
const ansiDoc = HelpDoc.toAnsiDoc(HelpDoc.p(span))
const rendered = AnsiDoc.render(ansiDoc, { style: "pretty" })
// ANSI foreground code 30 = black — invisible on dark/black terminal backgrounds.
// Weak spans must not produce this code.
expect(rendered).not.toMatch(/\x1b\[[0-9;]*30[;m]/)
})
})
})
Loading