<commit_before>package ui.components.pickers;

import backend.resource.TurboLabel;

import com.sun.javafx.tk.FontLoader;
import com.sun.javafx.tk.Toolkit;

import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.control.Tooltip;

/**
 * This class is to represent a label in LabelPickerDialog
 *
 * It contains attributes such as selected, highlighted, removed and faded in order
 * to produce the appropriate styled node through getNode()
 */
public class PickerBoard {

    private String boardName;
    private boolean isHighlighted;
    private boolean isFaded;

    public PickerBoard(String boardName) {
        this.boardName = boardName;
        isHighlighted = false;
        isFaded = false;
    }

    public String getStyle() {
        String colour = "b1cfeb";
        int r = Integer.parseInt(colour.substring(0, 2), 16);
        int g = Integer.parseInt(colour.substring(2, 4), 16);
        int b = Integer.parseInt(colour.substring(4, 6), 16);
        double luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
        boolean bright = luminance > 128;
        return "-fx-background-color: #" + colour + "; -fx-text-fill: " + (bright ? "black;" : "white;");
    }

    public Node getNode() {
        // actual name for labels at the top, add tick for selected labels
        Label label = new Label(boardName);
        label.getStyleClass().add("labels");
        String style = getStyle() + (isHighlighted ? " -fx-border-color: black;" : ""); // add highlight border
        style += (isFaded ? " -fx-opacity: 40%;" : ""); // change opacity if needed
        label.setStyle(style);

        FontLoader fontLoader = Toolkit.getToolkit().getFontLoader();
        double width = (double) fontLoader.computeStringWidth(label.getText(), label.getFont());
        label.setPrefWidth(width + 30);
        label.setText(label.getText());

        return label;
    }

    public PickerBoard highlighted(boolean isHighlighted) {
        this.isHighlighted = isHighlighted;
        return this;
    }

    public PickerBoard faded(boolean isFaded) {
        this.isFaded = isFaded;
        return this;
    }

}
<commit_msg>Improve highlighted board styling<commit_after>package ui.components.pickers;

import backend.resource.TurboLabel;

import com.sun.javafx.tk.FontLoader;
import com.sun.javafx.tk.Toolkit;

import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.control.Tooltip;

/**
 * This class is to represent a label in LabelPickerDialog
 *
 * It contains attributes such as selected, highlighted, removed and faded in order
 * to produce the appropriate styled node through getNode()
 */
public class PickerBoard {

    private String boardName;
    private boolean isHighlighted;
    private boolean isFaded;

    public PickerBoard(String boardName) {
        this.boardName = boardName;
        isHighlighted = false;
        isFaded = false;
    }

    public String getStyle() {
        String colour = "b1cfeb";
        int r = Integer.parseInt(colour.substring(0, 2), 16);
        int g = Integer.parseInt(colour.substring(2, 4), 16);
        int b = Integer.parseInt(colour.substring(4, 6), 16);
        double luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
        boolean bright = luminance > 128;
        return "-fx-background-color: #" + colour + "; -fx-text-fill: " + (bright ? "black;" : "white;");
    }

    public Node getNode() {
        // actual name for labels at the top, add tick for selected labels
        Label label = new Label(boardName);
        label.getStyleClass().add("labels");
        String style = getStyle() + (isHighlighted ? " -fx-border-color: black; -fx-font-weight: bold;" : "");
        style += (isFaded ? " -fx-opacity: 40%;" : ""); // change opacity if needed
        label.setStyle(style);

        FontLoader fontLoader = Toolkit.getToolkit().getFontLoader();
        double width = (double) fontLoader.computeStringWidth(label.getText(), label.getFont());
        label.setPrefWidth(width + 30);
        label.setText(label.getText());

        return label;
    }

    public PickerBoard highlighted(boolean isHighlighted) {
        this.isHighlighted = isHighlighted;
        return this;
    }

    public PickerBoard faded(boolean isFaded) {
        this.isFaded = isFaded;
        return this;
    }

}

{'fraction_non_alphanumeric': 0.11660124682521357, 'fraction_numerical': 0.01616254906488109, 'mean_word_length': 2.830238726790451, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6955668', 'n_tokens_mistral': 1330, 'n_tokens_neox': 1243, 'n_words': 344}