Kind: Function
Source: lib/command.js
Exported for using from tests, not otherwise used outside this file.
useColor is a helper exported from lib/command.js for test code. It exposes the command module's color-selection behavior without being used elsewhere outside that file.
Diagram
mermaidgraph LR Environment[Runtime environment] --> UseColor[useColor] UseColor --> ColorDecision[Color decision] ColorDecision --> Tests[Test assertions]
Usage
jsimport { useColor } from './lib/command.js';
const colorEnabled = useColor();
if (colorEnabled) {
console.log('Color output is enabled');
}
AI Coding Instructions
- Keep
useColorexported so tests can access the same color behavior aslib/command.js. - Test color-related behavior through
useColorrather than duplicating its decision logic in test files. - Avoid adding production call sites outside
lib/command.jsunless the module boundary is intentionally changed. - Account for runtime environment settings that may affect whether color output is enabled.
Was this page helpful?