Example usage for org.springframework.boot.ansi AnsiColor DEFAULT

List of usage examples for org.springframework.boot.ansi AnsiColor DEFAULT

Introduction

In this page you can find the example usage for org.springframework.boot.ansi AnsiColor DEFAULT.

Prototype

AnsiColor DEFAULT

To view the source code for org.springframework.boot.ansi AnsiColor DEFAULT.

Click Source Link

Usage

From source file:com.ebay.logstorm.server.utils.EagleBanner.java

@Override
public void printBanner(Environment environment, Class<?> sourceClass, PrintStream printStream) {
    for (String line : BANNER) {
        printStream.println(line);/*from   www  .j av  a2  s.  c o  m*/
    }
    String version = SpringBootVersion.getVersion();
    version = (version == null ? "" : " (v" + version + ")");
    String padding = "";
    while (padding.length() < STRAP_LINE_SIZE - (version.length() + SPRING_BOOT.length())) {
        padding += " ";
    }
    printStream.println(AnsiOutput.toString(AnsiColor.GREEN, SPRING_BOOT, AnsiColor.DEFAULT, padding,
            AnsiStyle.FAINT, version));
    printStream.println();
}

From source file:org.springframework.boot.ImageBanner.java

private void printBanner(BufferedImage image, int margin, boolean invert, PrintStream out) {
    AnsiElement background = (invert ? AnsiBackground.BLACK : AnsiBackground.DEFAULT);
    out.print(AnsiOutput.encode(AnsiColor.DEFAULT));
    out.print(AnsiOutput.encode(background));
    out.println();//from w  ww  .j a  v  a 2  s. co  m
    out.println();
    AnsiColor lastColor = AnsiColor.DEFAULT;
    for (int y = 0; y < image.getHeight(); y++) {
        for (int i = 0; i < margin; i++) {
            out.print(" ");
        }
        for (int x = 0; x < image.getWidth(); x++) {
            Color color = new Color(image.getRGB(x, y), false);
            AnsiColor ansiColor = AnsiColors.getClosest(color);
            if (ansiColor != lastColor) {
                out.print(AnsiOutput.encode(ansiColor));
                lastColor = ansiColor;
            }
            out.print(getAsciiPixel(color, invert));
        }
        out.println();
    }
    out.print(AnsiOutput.encode(AnsiColor.DEFAULT));
    out.print(AnsiOutput.encode(AnsiBackground.DEFAULT));
    out.println();
}