Skip to content

Commit

Permalink
Make sure bright colors are not completely ignored on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Sep 29, 2015
1 parent c69c78b commit bf3b544
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
12 changes: 8 additions & 4 deletions jansi/src/main/java/org/fusesource/jansi/AnsiOutputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,13 @@ private boolean processEscapeCommand(ArrayList<Object> options, int command) thr
count++;
int value = ((Integer)next).intValue();
if( 30 <= value && value <= 37 ) {
processSetForegroundColor(value-30);
processSetForegroundColor(value-30, false);
} else if( 40 <= value && value <= 47 ) {
processSetBackgroundColor(value-40);
processSetBackgroundColor(value-40, false);
} else if ( 90 <= value && value <= 97 ) {
processSetForegroundColor(value-90, true);
} else if ( 100 <= value && value <= 107 ) {
processSetBackgroundColor(value-100, true);
} else {
switch ( value ) {
case 39:
Expand Down Expand Up @@ -401,10 +405,10 @@ protected void processSetAttribute(int attribute) throws IOException {
protected static final int CYAN = 6;
protected static final int WHITE = 7;

protected void processSetForegroundColor(int color) throws IOException {
protected void processSetForegroundColor(int color, boolean bright) throws IOException {
}

protected void processSetBackgroundColor(int color) throws IOException {
protected void processSetBackgroundColor(int color, boolean bright) throws IOException {
}

protected void processDefaultTextColor() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ protected void processAttributeRest() throws IOException {
}

@Override
protected void processSetForegroundColor(int color) throws IOException {
protected void processSetForegroundColor(int color, boolean bright) throws IOException {
writeAttribute("span style=\"color: " + ANSI_COLOR_MAP[color] + ";\"");
}

@Override
protected void processSetBackgroundColor(int color) throws IOException {
protected void processSetBackgroundColor(int color, boolean bright) throws IOException {
writeAttribute("span style=\"background-color: " + ANSI_COLOR_MAP[color] + ";\"");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,13 @@ protected void processCursorToColumn(int x) throws IOException {
}

@Override
protected void processSetForegroundColor(int color) throws IOException {
protected void processSetForegroundColor(int color, boolean bright) throws IOException {
info.attributes = (short)((info.attributes & ~0x0007 ) | ANSI_FOREGROUND_COLOR_MAP[color]);
applyAttribute();
}

@Override
protected void processSetBackgroundColor(int color) throws IOException {
protected void processSetBackgroundColor(int color, boolean bright) throws IOException {
info.attributes = (short)((info.attributes & ~0x0070 ) | ANSI_BACKGROUND_COLOR_MAP[color]);
applyAttribute();
}
Expand Down

0 comments on commit bf3b544

Please sign in to comment.