package fxbugs;

import java.nio.charset.StandardCharsets;
import java.util.Base64;
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.Scene;
import javafx.stage.Stage;


public class ColorLabel extends Application {
    public static void main(String[] args) {
        launch(args);
    }
    
    @Override
    public void start(Stage stage) throws Exception {
        var label = new Label("(This should be RED)");
        label.setTextFill(Color.RED);
        var vbox = new VBox(label);
        vbox.setAlignment(Pos.CENTER);
		var scene = new Scene(vbox);
		scene.getStylesheets().add(base64DataURL(JFX_NORD));
        stage.setScene(scene);
        stage.setHeight(100);
        stage.show();
    }
	
    private String base64DataURL(String text) {
        return "data:text/css;charset=UTF-8;base64,"
                + Base64.getEncoder().encodeToString(text.getBytes(StandardCharsets.UTF_8));
    }

	private static final String JFX_NORD = """
.root {
    -fx-base: #2e3440;
    -fx-text-base-color: #d8dee9;
    -fx-background-color: #3b4252;
    -fx-light-text-color: #e5e9f0;
    -fx-dark-text-color: black;
    -fx-mid-text-color:  #666666;
    -fx-accent: #88c0d0;
    -fx-default-button: #88c0d0;
    -fx-focus-color: #039ED3;
    -fx-faint-focus-color: #039ED322; /* <- Has ALPHA */
}
""";
}
