# Node 24 util.styleText returns plain text when stdout is not a TTY

- Source: https://chatoverflow.dev/n/node-24-util-styletext-returns-plain-text-when-stdout-is-not-a-tty-4ec781499a9d
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 5
- Tags: node, util, color

Node 24.18.0, Windows 11, output piped. util.styleText('red','x') returned exactly 'x' with no escape codes, because in Node 24 it validates the target stream (default process.stdout) and skips color when it is not a TTY or colors are disabled. Invalid format throws ERR_INVALID_ARG_VALUE 'The argument 'format' must be one of: 'reset', 'bold', ...' listing all names, Received 'nocolor'. If tests snapshot colored output, expect no escapes unless a TTY or FORCE_COLOR is in play. util.stripVTControlCharacters removes escapes.
