diff --git a/.changeset/fix-cli-weak-span-dark-terminal.md b/.changeset/fix-cli-weak-span-dark-terminal.md new file mode 100644 index 00000000000..d3cbe86d02a --- /dev/null +++ b/.changeset/fix-cli-weak-span-dark-terminal.md @@ -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. diff --git a/packages/cli/src/internal/helpDoc/span.ts b/packages/cli/src/internal/helpDoc/span.ts index 249ea311654..c41251c9fd1 100644 --- a/packages/cli/src/internal/helpDoc/span.ts +++ b/packages/cli/src/internal/helpDoc/span.ts @@ -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) } } } diff --git a/packages/cli/test/HelpDoc.test.ts b/packages/cli/test/HelpDoc.test.ts new file mode 100644 index 00000000000..34c6ad44222 --- /dev/null +++ b/packages/cli/test/HelpDoc.test.ts @@ -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]/) + }) + }) +})