public Ansi bgBrightMagenta() { return this.bg(Color.MAGENTA); }
Ansi apply( Ansi ansi ) { if ( bold ) { ansi.bold(); } if ( color != null ) { if ( bright ) { ansi.fgBright( color ); } else { ansi.fg( color ); } } if ( bgColor != null ) { if ( bgBright ) { ansi.bgBright( bgColor ); } else { ansi.bg( bgColor ); } } return ansi; }
public Ansi bgDefault() { return this.bg(Color.DEFAULT); }
Ansi apply( Ansi ansi ) { if ( bold ) { ansi.bold(); } if ( color != null ) { if ( bright ) { ansi.fgBright( color ); } else { ansi.fg( color ); } } if ( bgColor != null ) { if ( bgBright ) { ansi.bgBright( bgColor ); } else { ansi.bg( bgColor ); } } return ansi; }
public Ansi bgYellow() { return this.bg(Color.YELLOW); }
public Ansi bgGreen() { return this.bg(Color.GREEN); }
public Ansi bgMagenta() { return this.bg(Color.MAGENTA); }
public Ansi bgRed() { return this.bg(Color.RED); }
if (!invertMatch && color != ColorOption.never) { matcher2.appendReplacement(sb, Ansi.ansi() .bg(Ansi.Color.YELLOW) .fg(Ansi.Color.BLACK) .a(matcher2.group())
/** * Displays Text highlighting the text that was marked as highlighted. * * @param text */ protected void displayText(String text) { if (highLight != null && !highLight.isEmpty() && text.contains(highLight)) { String highLightedText = text.replaceAll(highLight, ansi().bold().bg(theme.getHighLightBackground()).fg(theme.getHighLightForeground()).a(highLight).boldOff().reset().toString()); console.out().print(highLightedText); } else { console.out().print(text); } }
private static Ansi render(Ansi ansi, String name) { Code code = Code.valueOf(name.toUpperCase(Locale.ENGLISH)); if (code.isColor()) { if (code.isBackground()) { ansi.bg(code.getColor()); } else { ansi.fg(code.getColor()); } } else if (code.isAttribute()) { ansi.a(code.getAttribute()); } return ansi; }
private Ansi applyCode(Ansi ansi, Code code) { if (code.isColor()) { if (code.isBackground()) { return ansi.bg(code.getColor()); } return ansi.fg(code.getColor()); } return ansi.a(code.getAttribute()); }
private Ansi applyCode(Ansi ansi, Code code) { if (code.isColor()) { if (code.isBackground()) { return ansi.bg(code.getColor()); } return ansi.fg(code.getColor()); } return ansi.a(code.getAttribute()); }
private void render(final Ansi ansi, final Code code) { if (code.isColor()) { if (code.isBackground()) { ansi.bg(code.getColor()); } else { ansi.fg(code.getColor()); } } else if (code.isAttribute()) { ansi.a(code.getAttribute()); } }
/** * Refreshes the footer that displays the current line and column. */ public void redrawFooter() { saveCursorPosition(); Ansi style = ansi(); if (getTheme().getFooterBackground() != null) { style.bg(getTheme().getFooterBackground()); } if (getTheme().getFooterForeground() != null) { style.fg(getTheme().getFooterForeground()); } getConsole().out().print(style); getConsole().out().print(ansi().cursor(getTerminal().getHeight() + 1 - getFooterSize(), 1).eraseLine(Ansi.Erase.FORWARD)); for (int i = 1; i <= helpLines.size(); i++) { String helpLine = helpLines.get(i - 1); int startColumn = (getTerminal().getWidth() - helpLine.length()) / 2; getConsole().out().print(ansi().cursor(getTerminal().getHeight() + 1 - getFooterSize() + i, 1).eraseLine(Ansi.Erase.FORWARD)); getConsole().out().print(ansi().cursor(getTerminal().getHeight() + 1 - getFooterSize() + i, startColumn)); getConsole().out().print(helpLine); } getConsole().out().print(ansi().reset()); restoreCursorPosition(); }
public void redrawHeader() { saveCursorPosition(); getConsole().out().print(ansi().cursor(1, 1)); Ansi style = ansi(); if (getTheme().getHeaderBackground() != null) { style.bg(getTheme().getHeaderBackground()); } if (getTheme().getHeaderForeground() != null) { style.fg(getTheme().getHeaderForeground()); } String textCoords = "L:" + getLine() + " C:" + getColumn(); int displayFileLength = getTerminal().getWidth() - getTitle().length() - textCoords.length() - 1; getConsole().out().print(style.a(getTitle()).a(":").a(Strings.tryToTrimToSize(getDisplayAs(), displayFileLength)).a(isDirty() ? DIRTY_SIGN : "").eraseLine(Ansi.Erase.FORWARD)); getConsole().out().print(ansi().cursor(1, getTerminal().getWidth() - textCoords.length())); getConsole().out().print(ansi().a(textCoords).reset()); getConsole().out().print(ansi().cursor(getTerminal().getHeight(), 1)); restoreCursorPosition(); }
Ansi style = ansi(); if (getTheme().getPromptBackground() != null) { style.bg(getTheme().getPromptBackground());
public String readLine(String message) throws IOException { String result = null; saveCursorPosition(); Ansi style = ansi(); if (getTheme().getPromptBackground() != null) { style.bg(getTheme().getPromptBackground()); } if (getTheme().getPromptForeground() != null) { style.fg(getTheme().getPromptForeground()); } for (int i = 1; i <= getFooterSize(); i++) { console.out().print(ansi().cursor(terminal.getHeight() - getFooterSize() + i, 1)); console.out().print(style.eraseLine(Ansi.Erase.FORWARD)); } console.out().print(ansi().cursor(terminal.getHeight(), 1)); console.out().print(ansi().cursor(terminal.getHeight(), 1)); console.out().print(style.a(message).bold().eraseLine(Ansi.Erase.FORWARD)); flush(); try { result = readLine(); } finally { console.out().print(ansi().reset()); restoreCursorPosition(); redrawFooter(); } return result; }