<commit_before>/*
 * Copyright 2010 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.gradle.logging.internal;

import org.fusesource.jansi.Ansi;
import org.gradle.logging.StyledTextOutput;

import java.util.HashMap;
import java.util.Map;

import static org.fusesource.jansi.Ansi.Attribute;
import static org.fusesource.jansi.Ansi.Attribute.*;
import static org.fusesource.jansi.Ansi.Attribute.ITALIC;
import static org.fusesource.jansi.Ansi.Color.*;
import static org.gradle.logging.StyledTextOutput.Style.*;
import static org.gradle.logging.StyledTextOutput.Style.Success;

public class DefaultColorMap implements ColorMap {
    private static final String STATUSBAR = "statusbar";
    private static final String BOLD = "bold";
    private final Map<String, String> defaults = new HashMap<String, String>();
    private final Map<String, Color> colors = new HashMap<String, Color>();
    private boolean useColor = true;
    private final Color noDecoration = new Color() {
        public void on(Ansi ansi) {
        }

        public void off(Ansi ansi) {
        }
    };

    public DefaultColorMap() {
//        addDefault(Header, DEFAULT);
        addDefault(Info, YELLOW);
        addDefault(Description, YELLOW);
        addDefault(ProgressStatus, YELLOW);
        addDefault(Identifier, GREEN);
        addDefault(UserInput, GREEN);
        addDefault(Success, GREEN);
        addDefault(Failure, RED);
//        addDefault(Error, RED);
        defaults.put(STATUSBAR, BOLD);
    }

    private void addDefault(StyledTextOutput.Style style, Ansi.Color color) {
        defaults.put(style.name().toLowerCase(), color.name());
    }

    public void setUseColor(boolean useColor) {
        this.useColor = useColor;
    }

    public Color getStatusBarColor() {
        return getColor(STATUSBAR);
    }

    public Color getColourFor(StyledTextOutput.Style style) {
        return getColor(style.name().toLowerCase());
    }<commit_msg>Tweaked the default colours a little.<commit_after>/*
 * Copyright 2010 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.gradle.logging.internal;

import org.fusesource.jansi.Ansi;
import org.gradle.logging.StyledTextOutput;

import java.util.HashMap;
import java.util.Map;

import static org.fusesource.jansi.Ansi.Attribute;
import static org.fusesource.jansi.Ansi.Attribute.*;
import static org.fusesource.jansi.Ansi.Attribute.ITALIC;
import static org.fusesource.jansi.Ansi.Color.*;
import static org.gradle.logging.StyledTextOutput.Style.*;
import static org.gradle.logging.StyledTextOutput.Style.Success;

public class DefaultColorMap implements ColorMap {
    private static final String STATUSBAR = "statusbar";
    private static final String BOLD = "bold";
    private final Map<String, String> defaults = new HashMap<String, String>();
    private final Map<String, Color> colors = new HashMap<String, Color>();
    private boolean useColor = true;
    private final Color noDecoration = new Color() {
        public void on(Ansi ansi) {
        }

        public void off(Ansi ansi) {
        }
    };

    public DefaultColorMap() {
        addDefault(Info, "yellow");
        addDefault(Error, "default");
        addDefault(Header, "default");
        addDefault(Description, "yellow");
        addDefault(ProgressStatus, "yellow");
        addDefault(Identifier, "green");
        addDefault(UserInput, "bold");
        addDefault(Success, "default");
        addDefault(Failure, "red");
        addDefault(STATUSBAR, "bold");
    }

    private void addDefault(StyledTextOutput.Style style, String color) {
        addDefault(style.name().toLowerCase(), color);
    }

    private void addDefault(String style, String color) {
        defaults.put(style, color);
    }

    public void setUseColor(boolean useColor) {
        this.useColor = useColor;
    }

    public Color getStatusBarColor() {
        return getColor(STATUSBAR);
    }

    public Color getColourFor(StyledTextOutput.Style style) {
        return getColor(style.name().toLowerCase());
    }
{'fraction_non_alphanumeric': 0.09904650710254913, 'fraction_numerical': 0.0031134461957579296, 'mean_word_length': 3.465682015638575, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4337123', 'n_tokens_mistral': 1452, 'n_tokens_neox': 1405, 'n_words': 437}