Unexpected behaviour when bold and reverse ANSI attributes are combined #181

Open
opened 2026-01-30 21:44:52 +00:00 by claunia · 0 comments
Owner

Originally created by @j4james on GitHub (Mar 8, 2018).

Originally assigned to: @zadjii-msft on GitHub.

Windows build number: [Version 10.0.16299.248]

The ANSI sequence \033[1;7m sets both the bold (increased intensity) attribute and the negative/reverse attribute, but when those attributes are combined, I'd expected the increased intensity to apply to the final foreground color (i.e. after the colors have been reversed), so you'd get "bright" black on regular white, rather than black on bright white.

The former behaviour is what I see under MS-DOS (with ANSI.SYS) and the Linux console. But the Windows console applies the increased intensity to the foreground before the colors are reversed, so you end up with black on bright white instead.

Test case (from a bash shell): printf "\033[0;1;7m ACTUAL \033[0;1;30;47m EXPECTED \033[m\n"

I realise things are more complicated under Windows, since many more colors are supported, so it's possible this is intentional behaviour. However, I thought it best to bring it up in case it is a bug.

Also note that I'm referring to the behaviour as seen in a fresh console window. Things get weirder once you apply a 24-bit color and trigger the strange mode reported in issue #78. I'm not sure if the fix for that issue is likely to effect this behaviour too.

Originally created by @j4james on GitHub (Mar 8, 2018). Originally assigned to: @zadjii-msft on GitHub. **Windows build number:** [Version 10.0.16299.248] The ANSI sequence `\033[1;7m` sets both the bold (increased intensity) attribute and the negative/reverse attribute, but when those attributes are combined, I'd expected the increased intensity to apply to the *final* foreground color (i.e. after the colors have been reversed), so you'd get "bright" black on regular white, rather than black on bright white. The former behaviour is what I see under MS-DOS (with ANSI.SYS) and the Linux console. But the Windows console applies the increased intensity to the foreground *before* the colors are reversed, so you end up with black on bright white instead. **Test case (from a bash shell):** `printf "\033[0;1;7m ACTUAL \033[0;1;30;47m EXPECTED \033[m\n"` I realise things are more complicated under Windows, since many more colors are supported, so it's possible this is intentional behaviour. However, I thought it best to bring it up in case it is a bug. Also note that I'm referring to the behaviour as seen in a fresh console window. Things get weirder once you apply a 24-bit color and trigger the strange mode reported in issue #78. I'm not sure if the fix for that issue is likely to effect this behaviour too.
claunia added the Product-ConhostWork-ItemResolution-By-DesignIssue-BugArea-VT labels 2026-01-30 21:44:52 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#181