Users and CI expect no-color.org semantics for accessibility and logs.
Contracts and edge cases
Platform spec article
Contracts and edge cases
Spec standingStandard
-
Any non-empty NO_COLOR strips ANSI emission.
Context
Decision
Rule Detail NO_COLORNon-empty value must force ShouldEmitAnsi()falseReference no-color.org Consequences
Capability probes and markup render paths consult the same gate.
Verification anchors
CapabilitiesTests.bd;Console/Capabilities.bd. -
COLORTERM presence selects TrueColor when color allowed.
Context
Modern terminals advertise truecolor via COLORTERM without breaking NO_COLOR.
Decision
Rule Detail Probe COLORTERMset →TrueColorwhen color not strippedFORCE_COLORMay enable emission on non-TTY stdout Consequences
EffectiveColorModel reflects env probes before SGR downgrade (see D-CORE-TERM-0003).
Verification anchors
CapabilitiesTests.bd. -
RGB downgrades through palette ladders automatically.
Context
Callers should not manually pick CSI color modes per terminal.
Decision
Rule Detail Downgrade RGB → indexed → basic is lossy API No per-sequence model selector on public helpers Consequences
Styled output remains readable on Basic16 hosts without author branches.
Verification anchors
AnsiSgrGoldenTests.bd; capability + SGR integration.
- Contracts and edge cases MUST rules for capability probing and color stripping.
- Design model Capability record, color models, and environment-driven probing.
- Examples Checking capabilities before custom styling.
- Flow and algorithm Probe and strip algorithms for terminal capabilities.
- Verification and traceability Tests and sources for capability probing.
0 revisions (git unavailable at build; counts may be empty)
No commits recorded for this path.
| Section id | Required | Found |
|---|---|---|
what-this-feature-specifies | yes | yes |
implementation-anchors | yes | yes |
Full tree: run pnpm verify:platform-spec-layout (writes src/generated/platform-spec-layout-report.json).
Purpose
Section titled “Purpose”Document contracts and edge cases for the Console Capabilities feature: role-specific normative detail beyond the feature hub.
Canonical references
Section titled “Canonical references”- Feature hub: Console Capabilities
- Sibling articles in this bundle (design model, contracts, flow, examples, verification)
Detailed behavior
Section titled “Detailed behavior”Normative requirements
Section titled “Normative requirements”| ID | Requirement |
|---|---|
| CAP-001 | ShouldStripColor must return true when colorDisabled is true. |
| CAP-002 | When colorForced is true, ShouldStripColor must return false regardless of TTY. |
| CAP-003 | When neither forced nor disabled, non-TTY must strip color. |
| CAP-004 | ShouldEmitAnsi() must be consistent with ShouldStripColor(ProbeStdout()). |
| CAP-005 | EffectiveColorModel must return Basic16 whenever ShouldStripColor is true. |
Environment table
Section titled “Environment table”| Variable | Effect |
|---|---|
NO_COLOR | Disables color (CAP-001) |
FORCE_COLOR | Enables color even if not TTY |
COLORTERM | Upgrades model toward truecolor when color allowed |
TERM=dumb | ForcePlainText true |
TERM=xterm-256color | Indexed256 probe |
Edge cases
Section titled “Edge cases”- Empty vs unset env:
EnvFlagSettreats any non-empty value as set;NO_COLOR=may still disable per CAP-001. - stderr styling: v1 probes stdout only for
ShouldEmitAnsi; stderr diagnostics use the same predicate today. - CI logs: Piped stdout suppresses escapes unless
FORCE_COLOR=1in job env.
Verification
Section titled “Verification”See the verification and traceability article in this bundle and compiler/corelib/beskid_corelib/tests/corelib_tests/src/console/.
Related topics
Section titled “Related topics”- Parent feature hub and Terminal and console area