本文整理汇总了Java中org.fusesource.jansi.Ansi.Color方法的典型用法代码示例。如果您正苦于以下问题:Java Ansi.Color方法的具体用法?Java Ansi.Color怎么用?Java Ansi.Color使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.fusesource.jansi.Ansi
的用法示例。
在下文中一共展示了Ansi.Color方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: acceptInternal
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
@Override
public void acceptInternal(LogEvent event) {
Ansi.Color color = serviceColors.computeIfAbsent(event.getService(), (service) -> {
if (service.length() > this.longestServiceName) {
longestServiceName = service.length();
}
int colorIndex = serviceColors.size() % UNICORN_RAINBOW_MAGIC.size();
return UNICORN_RAINBOW_MAGIC.get(colorIndex);
});
System.out.println(ansi().
fg(color)
.a(padServiceName(event.getService()))
.a(" | ")
.reset()
.a(event.getLogEntry()));
}
示例2: translate
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
public static String translate(Object... elements) {
Ansi ansi = Ansi.ansi();
for (Object element : elements) {
if (element instanceof Ansi.Color) {
ansi.fg((Ansi.Color) element);
continue;
}
else if (element == RESET) {
ansi.reset();
continue;
}
ansi.a(element);
ansi.a(" ");
}
return ansi.toString();
}
示例3: createColor
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
private Color createColor(String style) {
String colorSpec = System.getProperty(String.format("org.gradle.color.%s", style), defaults.get(style));
if (colorSpec != null) {
if (colorSpec.equalsIgnoreCase(BOLD)) {
return new AttributeColor(INTENSITY_BOLD, INTENSITY_BOLD_OFF);
}
if (colorSpec.equalsIgnoreCase("reverse")) {
return new AttributeColor(NEGATIVE_ON, NEGATIVE_OFF);
}
if (colorSpec.equalsIgnoreCase("italic")) {
return new AttributeColor(ITALIC, ITALIC_OFF);
}
Ansi.Color ansiColor = Ansi.Color.valueOf(colorSpec.toUpperCase());
if (ansiColor != DEFAULT) {
return new ForegroundColor(ansiColor);
}
}
return noDecoration;
}
示例4: createColor
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
private Color createColor(String style) {
String colorSpec = System.getProperty("org.gradle.color." + style, defaults.get(style));
if (colorSpec != null) {
if (colorSpec.equalsIgnoreCase(BOLD)) {
return new AttributeColor(Attribute.INTENSITY_BOLD, Attribute.INTENSITY_BOLD_OFF);
}
if (colorSpec.equalsIgnoreCase("reverse")) {
return new AttributeColor(Attribute.NEGATIVE_ON, Attribute.NEGATIVE_OFF);
}
if (colorSpec.equalsIgnoreCase("italic")) {
return new AttributeColor(Attribute.ITALIC, Attribute.ITALIC_OFF);
}
Ansi.Color ansiColor = Ansi.Color.valueOf(colorSpec.toUpperCase());
if (ansiColor != DEFAULT) {
return new ForegroundColor(ansiColor);
}
}
return noDecoration;
}
示例5: description
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
/**
* Returns a description of the status
*
* @param configuration
*/
public String description(Configuration configuration) {
StringBuilder builder = new StringBuilder();
Ansi.Color color = Configuration.COLOR_PENDING;
if (status != null) {
switch (status) {
case COMPLETE:
color = Configuration.COLOR_COMPLETE;
break;
case FAILED:
color = Configuration.COLOR_WARNING;
break;
}
builder.append(status.getName());
builder.append(":");
}
if (issueUrl != null) {
builder.append(" issue ");
if (issueState != null) {
builder.append(format(issueState));
builder.append(" ");
}
builder.append(issueUrl);
}
if (pullRequestUrl != null) {
builder.append(" pull request ");
if (pullRequestState != null) {
builder.append(format(pullRequestState));
builder.append(" ");
}
builder.append(pullRequestUrl);
}
// lets add a trailing space just in case ansi color codes break URLs in logs ;)
builder.append(" ");
return configuration.colored(color, builder.toString());
}
示例6: colored
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
public String colored(Ansi.Color color, String message) {
if (!useAnsiColor()) {
return message;
}
Ansi ansi = ansi().fg(color);
return ansi.a(message).reset().toString();
}
示例7: logMessage
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
private void logMessage(int x, int y, String message, Ansi.Color fgColor, Ansi.Color bgColor, Ansi.Attribute... attributes) {
message = message.substring(0, Math.min(message.length(), 120));
Ansi ansi = ansi().cursor(y, x).eraseLine();
if(attributes != null) {
for (Ansi.Attribute attribute : attributes) {
ansi = ansi.a(attribute);
}
}
ansi = ansi.fg(fgColor != null ? fgColor : Ansi.Color.DEFAULT);
ansi = ansi.bg(bgColor != null ? bgColor : Ansi.Color.DEFAULT);
System.out.println(ansi.a(message).reset());
}
示例8: drawChartBar
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
private void drawChartBar(double value, Ansi.Color color) {
if(value <= 0) {
return;
}
int maxHeight = 40;
int maxWidth = 120;
int yLow = 47;
int yHigh = yLow - maxHeight;
int x = (int) (currentTime - initialTime + 1);
if(x > maxWidth) {
initialTime = currentTime;
System.out.println(ansi().eraseScreen().reset());
}
double dHighLow = marketHigh - marketLow;
int lines = (int) Math.round (maxHeight / dHighLow * (value - marketLow));
System.out.println(ansi().cursor(yLow + 1, x).eraseLine().a("-").reset());
System.out.println(ansi().cursor(yHigh - 1, x).eraseLine().a("-").reset());
for(int y=yLow,count=lines; count > 0; y--, count--) {
System.out.println(ansi().cursor(y, x).eraseLine().bg(color).a(" ").reset());
}
System.out.println(ansi().cursor(yLow - lines + 1, x + 1).eraseLine().a(marketOffer).reset());
for(int y=yLow - lines; y >= yHigh; y--) {
System.out.println(ansi().cursor(y, x).eraseLine().reset());
}
System.out.println(ansi().cursor(yLow + 1, x + 1).eraseLine().a(marketLow + " (low)").reset());
System.out.println(ansi().cursor(yHigh - 1, x + 1).eraseLine().a(marketHigh + " (high)").reset());
}
示例9: render
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
public void render(final VirtualMachine machine, final int index)
{
boolean agentLoaded = machine.isAgentLoaded();
Ansi.Color color = agentLoaded ? GREEN : DEFAULT;
String prefix = agentLoaded ? index + ": " : " - ";
terminal.write(a -> a.fg(color)
.a(prefix)
.a(machine.getDisplayName())
.reset());
}
示例10: printWithColor
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
@Override
public synchronized Future<?> printWithColor(final Ansi.Color color, final String message) {
try {
lastTask = singleThreadExecutor.submit(new ConsolePrinterRunnable(color, message));
return lastTask;
} catch (RejectedExecutionException ignore) {
}
return null;
}
示例11: printForOperationOrFlow
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
private void printForOperationOrFlow(Map<String, Serializable> data, Ansi.Color color,
String operationMessage, String flowMessage) {
if (LanguageEventData.StepType.OPERATION.equals(data.get(LanguageEventData.STEP_TYPE))) {
consolePrinter.printWithColor(color, operationMessage);
} else {
consolePrinter.printWithColor(color, flowMessage);
}
}
示例12: color
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
private Ansi.Color color(final String lvl, final String aDefault) {
try {
return Ansi.Color.valueOf(SystemInstance.get().getProperty(OPENEJB_LOG_COLOR_PREFIX + lvl, aDefault));
} catch (final IllegalArgumentException iae) {
return Ansi.Color.valueOf(aDefault);
}
}
示例13: ForegroundColor
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
public ForegroundColor(Ansi.Color ansiColor) {
this.ansiColor = ansiColor;
}
示例14: fontColor
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
private ColoredConsoleConverter fontColor(final Ansi.Color font) {
this.fontColor = font;
return this;
}
示例15: borderColor
import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
public ColoredConsoleConverter borderColor(final Ansi.Color border) {
this.borderColor = border;
return this;
}