Skip to content

Commit bf3b544

Browse files
committed
Make sure bright colors are not completely ignored on windows
1 parent c69c78b commit bf3b544

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

jansi/src/main/java/org/fusesource/jansi/AnsiOutputStream.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,13 @@ private boolean processEscapeCommand(ArrayList<Object> options, int command) thr
272272
count++;
273273
int value = ((Integer)next).intValue();
274274
if( 30 <= value && value <= 37 ) {
275-
processSetForegroundColor(value-30);
275+
processSetForegroundColor(value-30, false);
276276
} else if( 40 <= value && value <= 47 ) {
277-
processSetBackgroundColor(value-40);
277+
processSetBackgroundColor(value-40, false);
278+
} else if ( 90 <= value && value <= 97 ) {
279+
processSetForegroundColor(value-90, true);
280+
} else if ( 100 <= value && value <= 107 ) {
281+
processSetBackgroundColor(value-100, true);
278282
} else {
279283
switch ( value ) {
280284
case 39:
@@ -401,10 +405,10 @@ protected void processSetAttribute(int attribute) throws IOException {
401405
protected static final int CYAN = 6;
402406
protected static final int WHITE = 7;
403407

404-
protected void processSetForegroundColor(int color) throws IOException {
408+
protected void processSetForegroundColor(int color, boolean bright) throws IOException {
405409
}
406410

407-
protected void processSetBackgroundColor(int color) throws IOException {
411+
protected void processSetBackgroundColor(int color, boolean bright) throws IOException {
408412
}
409413

410414
protected void processDefaultTextColor() throws IOException {

jansi/src/main/java/org/fusesource/jansi/HtmlAnsiOutputStream.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@ protected void processAttributeRest() throws IOException {
127127
}
128128

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

134134
@Override
135-
protected void processSetBackgroundColor(int color) throws IOException {
135+
protected void processSetBackgroundColor(int color, boolean bright) throws IOException {
136136
writeAttribute("span style=\"background-color: " + ANSI_COLOR_MAP[color] + ";\"");
137137
}
138138
}

jansi/src/main/java/org/fusesource/jansi/WindowsAnsiOutputStream.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,13 @@ protected void processCursorToColumn(int x) throws IOException {
227227
}
228228

229229
@Override
230-
protected void processSetForegroundColor(int color) throws IOException {
230+
protected void processSetForegroundColor(int color, boolean bright) throws IOException {
231231
info.attributes = (short)((info.attributes & ~0x0007 ) | ANSI_FOREGROUND_COLOR_MAP[color]);
232232
applyAttribute();
233233
}
234234

235235
@Override
236-
protected void processSetBackgroundColor(int color) throws IOException {
236+
protected void processSetBackgroundColor(int color, boolean bright) throws IOException {
237237
info.attributes = (short)((info.attributes & ~0x0070 ) | ANSI_BACKGROUND_COLOR_MAP[color]);
238238
applyAttribute();
239239
}

0 commit comments

Comments
 (0)