001/**
002 * Logback: the reliable, generic, fast and flexible logging framework.
003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved.
004 *
005 * This program and the accompanying materials are dual-licensed under
006 * either the terms of the Eclipse Public License v1.0 as published by
007 * the Eclipse Foundation
008 *
009 *   or (per the licensee's choosing)
010 *
011 * under the terms of the GNU Lesser General Public License version 2.1
012 * as published by the Free Software Foundation.
013 */
014package ch.qos.logback.classic.html;
015
016import ch.qos.logback.core.CoreConstants;
017import static ch.qos.logback.core.CoreConstants.LINE_SEPARATOR;
018import ch.qos.logback.core.html.CssBuilder;
019
020/**
021 * This class helps the HTMLLayout build the CSS link. It either provides the
022 * HTMLLayout with a default css file, or builds the link to an external,
023 * user-specified, file.
024 * 
025 * @author Sébastien Pennec
026 */
027public class DefaultCssBuilder implements CssBuilder {
028
029    public void addCss(StringBuilder sbuf) {
030        sbuf.append("<style  type=\"text/css\">");
031        sbuf.append(LINE_SEPARATOR);
032        sbuf.append("table { margin-left: 2em; margin-right: 2em; border-left: 2px solid #AAA; }");
033        sbuf.append(LINE_SEPARATOR);
034
035        sbuf.append("TR.even { background: #FFFFFF; }");
036        sbuf.append(LINE_SEPARATOR);
037
038        sbuf.append("TR.odd { background: #EAEAEA; }");
039        sbuf.append(LINE_SEPARATOR);
040
041        sbuf.append("TR.warn TD.Level, TR.error TD.Level, TR.fatal TD.Level {font-weight: bold; color: #FF4040 }");
042        sbuf.append(CoreConstants.LINE_SEPARATOR);
043
044        sbuf.append("TD { padding-right: 1ex; padding-left: 1ex; border-right: 2px solid #AAA; }");
045        sbuf.append(LINE_SEPARATOR);
046
047        sbuf.append("TD.Time, TD.Date { text-align: right; font-family: courier, monospace; font-size: smaller; }");
048        sbuf.append(LINE_SEPARATOR);
049
050        sbuf.append("TD.Thread { text-align: left; }");
051        sbuf.append(LINE_SEPARATOR);
052
053        sbuf.append("TD.Level { text-align: right; }");
054        sbuf.append(LINE_SEPARATOR);
055
056        sbuf.append("TD.Logger { text-align: left; }");
057        sbuf.append(LINE_SEPARATOR);
058
059        sbuf.append("TR.header { background: #596ED5; color: #FFF; font-weight: bold; font-size: larger; }");
060        sbuf.append(CoreConstants.LINE_SEPARATOR);
061
062        sbuf.append("TD.Exception { background: #A2AEE8; font-family: courier, monospace;}");
063        sbuf.append(LINE_SEPARATOR);
064
065        sbuf.append("</style>");
066        sbuf.append(LINE_SEPARATOR);
067    }
068}