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

Fix terminal color on Windows #58

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/main/java/net/kyori/ansi/ColorLevel.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
package net.kyori.ansi;

import java.util.Locale;

import jdk.internal.org.jline.utils.OSUtils;
import org.jetbrains.annotations.NotNull;

/**
Expand Down Expand Up @@ -159,7 +161,6 @@ public enum ColorLevel {

private static final String COLORTERM = System.getenv("COLORTERM");
private static final String TERM = System.getenv("TERM");
private static final String WT_SESSION = System.getenv("WT_SESSION");
private static int[] indexed256ColorTable = null;

/**
Expand Down Expand Up @@ -204,8 +205,8 @@ public enum ColorLevel {
} else if (TERM.contains("-256color")) {
return ColorLevel.INDEXED_256;
}
} else if (WT_SESSION != null) {
return ColorLevel.TRUE_COLOR; // Windows Terminal
} else if (OSUtils.IS_WINDOWS) {
return ColorLevel.TRUE_COLOR; // We can assume that Windows always supports true color
} else if (System.console() != null) {
if (JAnsiColorLevel.isAvailable()) {
return JAnsiColorLevel.computeFromJAnsi();
Expand Down