| 1594 | // Set an Ansi or MS Windows text color. |
| 1595 | |
| 1596 | void AnsiColor(KI k) |
| 1597 | { |
| 1598 | char sz[cchSzDef]; |
| 1599 | int cchSav; |
| 1600 | |
| 1601 | #ifdef WIN |
| 1602 | if (is.S == stdout) { |
| 1603 | if (k == kDefault || !us.fAnsiColor) |
| 1604 | k = kLtGrayA; |
| 1605 | SetTextColor(wi.hdc, (COLORREF)KvFromKi(k)); |
| 1606 | return; |
| 1607 | } |
| 1608 | #endif |
| 1609 | |
| 1610 | // Special case: If passed the "color" Reverse, and Ansi color is not only |
| 1611 | // on but set to a value > 1, then enter reverse video mode. |
| 1612 | |
| 1613 | if (!us.fAnsiColor || (k == kReverse && us.fAnsiColor < 2)) |
| 1614 | return; |
| 1615 | cchSav = is.cchCol; |
| 1616 | is.cchCol = 0; |
| 1617 | if (is.nHTML <= 0) { |
| 1618 | sprintf(sz, "%c[", chEscape); |
| 1619 | PrintSz(sz); |
| 1620 | if (k == kDefault) |
| 1621 | PrintCh('0'); |
| 1622 | else if (k == kReverse) { |
| 1623 | PrintCh('7'); |
| 1624 | } else { |
| 1625 | sprintf(sz, "%c;%d", k > 7 ? '1' : '0', 30 + (k & 7)); |
| 1626 | PrintSz(sz); |
| 1627 | } |
| 1628 | PrintCh('m'); |
| 1629 | } else { |
| 1630 | if (is.nHTML != 3) { |
| 1631 | is.nHTML = 2; |
| 1632 | PrintSz("</font>"); |
| 1633 | } else |
| 1634 | is.nHTML = 2; |
| 1635 | if (k < 0) |
| 1636 | k = kLtGrayA; |
| 1637 | PrintSz("<font color=\""); |
| 1638 | PrintSz(SzColorHTML(k)); |
| 1639 | PrintSz("\">"); |
| 1640 | is.nHTML = 1; |
| 1641 | } |
| 1642 | is.cchCol = cchSav; |
| 1643 | } |
| 1644 | |
| 1645 | |
| 1646 | // Print a zodiac position on the screen. This basically just prints the |
no test coverage detected