当前位置: 首页>>代码示例>>Java>>正文


Java Ansi.Color方法代码示例

本文整理汇总了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()));
}
 
开发者ID:swissquote,项目名称:carnotzet,代码行数:17,代码来源:StdOutLogPrinter.java

示例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();
    }
 
开发者ID:dzikoysk,项目名称:NanoMaven,代码行数:21,代码来源:AnsiUtils.java

示例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;
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:23,代码来源:DefaultColorMap.java

示例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;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:23,代码来源:DefaultColorMap.java

示例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());
}
 
开发者ID:fabric8-updatebot,项目名称:updatebot,代码行数:41,代码来源:StatusInfo.java

示例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();
}
 
开发者ID:fabric8-updatebot,项目名称:updatebot,代码行数:8,代码来源:Configuration.java

示例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());
}
 
开发者ID:IG-Group,项目名称:ig-webapi-java-sample,代码行数:13,代码来源:Application.java

示例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());
}
 
开发者ID:IG-Group,项目名称:ig-webapi-java-sample,代码行数:29,代码来源:Application.java

示例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());
}
 
开发者ID:jvm-profiling-tools,项目名称:honest-profiler,代码行数:11,代码来源:MachinePickerView.java

示例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;
}
 
开发者ID:CloudSlang,项目名称:cloud-slang,代码行数:10,代码来源:ConsolePrinterImpl.java

示例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);
    }
}
 
开发者ID:CloudSlang,项目名称:cloud-slang,代码行数:9,代码来源:SyncTriggerEventListener.java

示例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);
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:8,代码来源:ColorFormatter.java

示例13: ForegroundColor

import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
public ForegroundColor(Ansi.Color ansiColor) {
    this.ansiColor = ansiColor;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:DefaultColorMap.java

示例14: fontColor

import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
private ColoredConsoleConverter fontColor(final Ansi.Color font) {
    this.fontColor = font;
    return this;
}
 
开发者ID:sarojaba,项目名称:prettytable4j,代码行数:5,代码来源:ColoredConsoleConverter.java

示例15: borderColor

import org.fusesource.jansi.Ansi; //导入方法依赖的package包/类
public ColoredConsoleConverter borderColor(final Ansi.Color border) {
    this.borderColor = border;
    return this;
}
 
开发者ID:sarojaba,项目名称:prettytable4j,代码行数:5,代码来源:ColoredConsoleConverter.java


注:本文中的org.fusesource.jansi.Ansi.Color方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。