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


Java Attribute类代码示例

本文整理汇总了Java中org.fusesource.jansi.Ansi.Attribute的典型用法代码示例。如果您正苦于以下问题:Java Attribute类的具体用法?Java Attribute怎么用?Java Attribute使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Attribute类属于org.fusesource.jansi.Ansi包,在下文中一共展示了Attribute类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: withColor

import org.fusesource.jansi.Ansi.Attribute; //导入依赖的package包/类
String withColor( Color color, boolean bright, Attribute attribute, String text ) {
    if( withColor ) {
        Ansi ansi = bright ? Ansi.ansi().fgBright( color ) : Ansi.ansi().fg( color );
        if( attribute != null ) {
            ansi = ansi.a( attribute );
        }
        return ansi.a( text ).reset().toString();
    }
    return text;
}
 
开发者ID:TNG,项目名称:JGiven,代码行数:11,代码来源:PlainTextWriter.java

示例2: printString

import org.fusesource.jansi.Ansi.Attribute; //导入依赖的package包/类
public static void printString(String string)
{
	try
	{
		string = string.replaceAll("�", "");
           for (Character color : mColors.keySet()) 
               string = string.replaceAll(mColorChar + color, mColors.get(color));
		
           AnsiConsole.out.println(ConsoleReader.RESET_LINE + string + Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.DEFAULT));
		
		mConsole.redrawLine();
		mConsole.flushConsole();
	}
	catch(IOException e)
	{
	}
}
 
开发者ID:Schmoller,项目名称:BetterRCon,代码行数:18,代码来源:ConsoleMain.java

示例3: ColouredConsoleSender

import org.fusesource.jansi.Ansi.Attribute; //导入依赖的package包/类
protected ColouredConsoleSender() {
    super();
    this.terminal = ((CraftServer) getServer()).getReader().getTerminal();

    replacements.put(ChatColor.BLACK, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.BLACK).boldOff().toString());
    replacements.put(ChatColor.DARK_BLUE, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.BLUE).boldOff().toString());
    replacements.put(ChatColor.DARK_GREEN, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.GREEN).boldOff().toString());
    replacements.put(ChatColor.DARK_AQUA, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.CYAN).boldOff().toString());
    replacements.put(ChatColor.DARK_RED, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.RED).boldOff().toString());
    replacements.put(ChatColor.DARK_PURPLE, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.MAGENTA).boldOff().toString());
    replacements.put(ChatColor.GOLD, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.YELLOW).boldOff().toString());
    replacements.put(ChatColor.GRAY, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.WHITE).boldOff().toString());
    replacements.put(ChatColor.DARK_GRAY, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.BLACK).bold().toString());
    replacements.put(ChatColor.BLUE, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.BLUE).bold().toString());
    replacements.put(ChatColor.GREEN, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.GREEN).bold().toString());
    replacements.put(ChatColor.AQUA, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.CYAN).bold().toString());
    replacements.put(ChatColor.RED, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.RED).bold().toString());
    replacements.put(ChatColor.LIGHT_PURPLE, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.MAGENTA).bold().toString());
    replacements.put(ChatColor.YELLOW, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.YELLOW).bold().toString());
    replacements.put(ChatColor.WHITE, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.WHITE).bold().toString());
    replacements.put(ChatColor.MAGIC, Ansi.ansi().a(Attribute.BLINK_SLOW).toString());
    replacements.put(ChatColor.BOLD, Ansi.ansi().a(Attribute.UNDERLINE_DOUBLE).toString());
    replacements.put(ChatColor.STRIKETHROUGH, Ansi.ansi().a(Attribute.STRIKETHROUGH_ON).toString());
    replacements.put(ChatColor.UNDERLINE, Ansi.ansi().a(Attribute.UNDERLINE).toString());
    replacements.put(ChatColor.ITALIC, Ansi.ansi().a(Attribute.ITALIC).toString());
    replacements.put(ChatColor.RESET, Ansi.ansi().a(Attribute.RESET).toString());
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:28,代码来源:ColouredConsoleSender.java

示例4: MainLogger

import org.fusesource.jansi.Ansi.Attribute; //导入依赖的package包/类
public MainLogger(String logFile, Boolean logDebug) {
    AnsiConsole.systemInstall();

    if (logger != null) {
        throw new RuntimeException("MainLogger has been already created");
    }
    logger = this;
    this.logFile = new File(logFile);
    if (!this.logFile.exists()) {
        try {
            this.logFile.createNewFile();
        } catch (IOException e) {
            this.logException(e);
        }
    }
    replacements.put(TextFormat.BLACK, Ansi.ansi().a(Attribute.RESET).fg(Color.BLACK).boldOff().toString());
    replacements.put(TextFormat.DARK_BLUE, Ansi.ansi().a(Attribute.RESET).fg(Color.BLUE).boldOff().toString());
    replacements.put(TextFormat.DARK_GREEN, Ansi.ansi().a(Attribute.RESET).fg(Color.GREEN).boldOff().toString());
    replacements.put(TextFormat.DARK_AQUA, Ansi.ansi().a(Attribute.RESET).fg(Color.CYAN).boldOff().toString());
    replacements.put(TextFormat.DARK_RED, Ansi.ansi().a(Attribute.RESET).fg(Color.RED).boldOff().toString());
    replacements.put(TextFormat.DARK_PURPLE, Ansi.ansi().a(Attribute.RESET).fg(Color.MAGENTA).boldOff().toString());
    replacements.put(TextFormat.GOLD, Ansi.ansi().a(Attribute.RESET).fg(Color.YELLOW).boldOff().toString());
    replacements.put(TextFormat.GRAY, Ansi.ansi().a(Attribute.RESET).fg(Color.WHITE).boldOff().toString());
    replacements.put(TextFormat.DARK_GRAY, Ansi.ansi().a(Attribute.RESET).fg(Color.BLACK).bold().toString());
    replacements.put(TextFormat.BLUE, Ansi.ansi().a(Attribute.RESET).fg(Color.BLUE).bold().toString());
    replacements.put(TextFormat.GREEN, Ansi.ansi().a(Attribute.RESET).fg(Color.GREEN).bold().toString());
    replacements.put(TextFormat.AQUA, Ansi.ansi().a(Attribute.RESET).fg(Color.CYAN).bold().toString());
    replacements.put(TextFormat.RED, Ansi.ansi().a(Attribute.RESET).fg(Color.RED).bold().toString());
    replacements.put(TextFormat.LIGHT_PURPLE, Ansi.ansi().a(Attribute.RESET).fg(Color.MAGENTA).bold().toString());
    replacements.put(TextFormat.YELLOW, Ansi.ansi().a(Attribute.RESET).fg(Color.YELLOW).bold().toString());
    replacements.put(TextFormat.WHITE, Ansi.ansi().a(Attribute.RESET).fg(Color.WHITE).bold().toString());
    replacements.put(TextFormat.BOLD, Ansi.ansi().a(Attribute.UNDERLINE_DOUBLE).toString());
    replacements.put(TextFormat.STRIKETHROUGH, Ansi.ansi().a(Attribute.STRIKETHROUGH_ON).toString());
    replacements.put(TextFormat.UNDERLINE, Ansi.ansi().a(Attribute.UNDERLINE).toString());
    replacements.put(TextFormat.ITALIC, Ansi.ansi().a(Attribute.ITALIC).toString());
    replacements.put(TextFormat.RESET, Ansi.ansi().a(Attribute.RESET).toString());
    this.logDebug = logDebug;
    this.start();
}
 
开发者ID:Creeperface01,项目名称:NukkitGT,代码行数:40,代码来源:MainLogger.java

示例5: visitEnd

import org.fusesource.jansi.Ansi.Attribute; //导入依赖的package包/类
@Override
public void visitEnd( ScenarioCaseModel scenarioCase ) {
    if( !scenarioCase.isSuccess() ) {
        writer.println();
        writer.print( withColor( Color.RED, Attribute.INTENSITY_BOLD, "FAILED: " + scenarioCase.getErrorMessage() ) );
    }
    writer.println();
}
 
开发者ID:TNG,项目名称:JGiven,代码行数:9,代码来源:PlainTextScenarioWriter.java

示例6: ColouredConsoleSender

import org.fusesource.jansi.Ansi.Attribute; //导入依赖的package包/类
protected ColouredConsoleSender() {
    super();
    this.reader = ((CraftServer) getServer()).getReader();
    this.terminal = reader.getTerminal();

    replacements.put(ChatColor.BLACK, Ansi.ansi().fg(Ansi.Color.BLACK).boldOff().toString());
    replacements.put(ChatColor.DARK_BLUE, Ansi.ansi().fg(Ansi.Color.BLUE).boldOff().toString());
    replacements.put(ChatColor.DARK_GREEN, Ansi.ansi().fg(Ansi.Color.GREEN).boldOff().toString());
    replacements.put(ChatColor.DARK_AQUA, Ansi.ansi().fg(Ansi.Color.CYAN).boldOff().toString());
    replacements.put(ChatColor.DARK_RED, Ansi.ansi().fg(Ansi.Color.RED).boldOff().toString());
    replacements.put(ChatColor.DARK_PURPLE, Ansi.ansi().fg(Ansi.Color.MAGENTA).boldOff().toString());
    replacements.put(ChatColor.GOLD, Ansi.ansi().fg(Ansi.Color.YELLOW).boldOff().toString());
    replacements.put(ChatColor.GRAY, Ansi.ansi().fg(Ansi.Color.WHITE).boldOff().toString());
    replacements.put(ChatColor.DARK_GRAY, Ansi.ansi().fg(Ansi.Color.BLACK).bold().toString());
    replacements.put(ChatColor.BLUE, Ansi.ansi().fg(Ansi.Color.BLUE).bold().toString());
    replacements.put(ChatColor.GREEN, Ansi.ansi().fg(Ansi.Color.GREEN).bold().toString());
    replacements.put(ChatColor.AQUA, Ansi.ansi().fg(Ansi.Color.CYAN).bold().toString());
    replacements.put(ChatColor.RED, Ansi.ansi().fg(Ansi.Color.RED).bold().toString());
    replacements.put(ChatColor.LIGHT_PURPLE, Ansi.ansi().fg(Ansi.Color.MAGENTA).bold().toString());
    replacements.put(ChatColor.YELLOW, Ansi.ansi().fg(Ansi.Color.YELLOW).bold().toString());
    replacements.put(ChatColor.WHITE, Ansi.ansi().fg(Ansi.Color.WHITE).bold().toString());
    replacements.put(ChatColor.MAGIC, Ansi.ansi().a(Attribute.BLINK_SLOW).toString());
    replacements.put(ChatColor.BOLD, Ansi.ansi().a(Attribute.UNDERLINE_DOUBLE).toString());
    replacements.put(ChatColor.STRIKETHROUGH, Ansi.ansi().a(Attribute.STRIKETHROUGH_ON).toString());
    replacements.put(ChatColor.UNDERLINE, Ansi.ansi().a(Attribute.UNDERLINE).toString());
    replacements.put(ChatColor.ITALIC, Ansi.ansi().a(Attribute.ITALIC).toString());
    replacements.put(ChatColor.RESET, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.DEFAULT).toString());
}
 
开发者ID:agaricusb,项目名称:MCPBukkit,代码行数:29,代码来源:ColouredConsoleSender.java

示例7: isAttribute

import org.fusesource.jansi.Ansi.Attribute; //导入依赖的package包/类
public boolean isAttribute() {
    return n instanceof Attribute;
}
 
开发者ID:tomas-langer,项目名称:chalk,代码行数:4,代码来源:AnsiRenderer.java

示例8: getAttribute

import org.fusesource.jansi.Ansi.Attribute; //导入依赖的package包/类
public Attribute getAttribute() {
    return (Attribute) n;
}
 
开发者ID:tomas-langer,项目名称:chalk,代码行数:4,代码来源:AnsiRenderer.java

示例9: colorize

import org.fusesource.jansi.Ansi.Attribute; //导入依赖的package包/类
private static String colorize(String msg) {
	ansicolors.put(ChatColor.BLACK,
			Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.BLACK).boldOff()
					.toString());
	ansicolors.put(ChatColor.DARK_BLUE,
			Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.BLUE).boldOff()
					.toString());
	ansicolors.put(ChatColor.DARK_GREEN,
			Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.GREEN).boldOff()
					.toString());
	ansicolors.put(ChatColor.DARK_AQUA,
			Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.CYAN).boldOff()
					.toString());
	ansicolors.put(ChatColor.DARK_RED,
			Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.RED).boldOff()
					.toString());
	ansicolors.put(ChatColor.DARK_PURPLE, Ansi.ansi().a(Attribute.RESET)
			.fg(Ansi.Color.MAGENTA).boldOff().toString());
	ansicolors.put(ChatColor.GOLD,
			Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.YELLOW).boldOff()
					.toString());
	ansicolors.put(ChatColor.GRAY,
			Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.WHITE).boldOff()
					.toString());
	ansicolors.put(ChatColor.DARK_GRAY,
			Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.BLACK).bold()
					.toString());
	ansicolors.put(ChatColor.BLUE,
			Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.BLUE).bold()
					.toString());
	ansicolors.put(ChatColor.GREEN,
			Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.GREEN).bold()
					.toString());
	ansicolors.put(ChatColor.AQUA,
			Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.CYAN).bold()
					.toString());
	ansicolors.put(ChatColor.RED,
			Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.RED).bold()
					.toString());
	ansicolors.put(ChatColor.LIGHT_PURPLE, Ansi.ansi().a(Attribute.RESET)
			.fg(Ansi.Color.MAGENTA).bold().toString());
	ansicolors.put(ChatColor.YELLOW,
			Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.YELLOW).bold()
					.toString());
	ansicolors.put(ChatColor.WHITE,
			Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.WHITE).bold()
					.toString());
	ansicolors.put(ChatColor.MAGIC, Ansi.ansi().a(Attribute.BLINK_SLOW)
			.toString());
	ansicolors.put(ChatColor.BOLD, Ansi.ansi()
			.a(Attribute.UNDERLINE_DOUBLE).toString());
	ansicolors.put(ChatColor.STRIKETHROUGH,
			Ansi.ansi().a(Attribute.STRIKETHROUGH_ON).toString());
	ansicolors.put(ChatColor.UNDERLINE, Ansi.ansi().a(Attribute.UNDERLINE)
			.toString());
	ansicolors.put(ChatColor.ITALIC, Ansi.ansi().a(Attribute.ITALIC)
			.toString());
	ansicolors.put(ChatColor.RESET, Ansi.ansi().a(Attribute.RESET)
			.toString());

	for (ChatColor c : colors) {
		if (!ansicolors.containsKey(c)) {
			msg = msg.replaceAll(c.toString(), "");
		} else {
			msg = msg.replaceAll(c.toString(), ansicolors.get(c));
		}
	}
	return msg;
}
 
开发者ID:Tabinol,项目名称:Factoid,代码行数:70,代码来源:ColoredConsole.java

示例10: boldGray

import org.fusesource.jansi.Ansi.Attribute; //导入依赖的package包/类
String boldGray( String text ) {
    return withColor( Color.BLACK, true, Attribute.INTENSITY_BOLD, text );
}
 
开发者ID:TNG,项目名称:JGiven,代码行数:4,代码来源:PlainTextWriter.java

示例11: boldRed

import org.fusesource.jansi.Ansi.Attribute; //导入依赖的package包/类
String boldRed( String text ) {
    return withColor( Color.RED, false, Attribute.INTENSITY_BOLD, text );
}
 
开发者ID:TNG,项目名称:JGiven,代码行数:4,代码来源:PlainTextWriter.java


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