Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support disable-bold,real-underline and native reverse-color. #50

Merged
merged 1 commit into from May 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 11 additions & 5 deletions colorable_windows.go
Expand Up @@ -27,6 +27,8 @@ const (
backgroundRed = 0x40
backgroundIntensity = 0x80
backgroundMask = (backgroundRed | backgroundBlue | backgroundGreen | backgroundIntensity)
commonLvbReverse = 0x4000
commonLvbUnderscore = 0x8000

cENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x4
)
Expand Down Expand Up @@ -683,14 +685,18 @@ loop:
switch {
case n == 0 || n == 100:
attr = w.oldattr
case 1 <= n && n <= 5:
case n == 4:
attr |= commonLvbUnderscore
case (1 <= n && n <= 3) || n == 5:
attr |= foregroundIntensity
case n == 7:
attr = ((attr & foregroundMask) << 4) | ((attr & backgroundMask) >> 4)
case n == 22 || n == 25:
attr |= foregroundIntensity
attr |= commonLvbReverse
case n == 22:
attr &^= foregroundIntensity
case n == 24:
attr &^= commonLvbUnderscore
case n == 27:
attr = ((attr & foregroundMask) << 4) | ((attr & backgroundMask) >> 4)
attr &^= commonLvbReverse
case 30 <= n && n <= 37:
attr &= backgroundMask
if (n-30)&1 != 0 {
Expand Down