Well, here's a simple script that displays an alert with the CIE Chroma and CIE Hue angle information.
InDesign HSB is useless because it is based on RGB.
I am not by any means a JavaScript specialist.
// Roger Breton / March 18 2024
// Get the active document
var doc = app.activeDocument;
// Check if there's a selection
if (doc.selection.length > 0) {
// Get the first selected item
var selectedItem = doc.selection[0];
// Check if the selected item has a fill color
if (selectedItem.fillColor !== undefined) {
// Retrieve the fill color
var fillColor = selectedItem.fillColor;
var fillModel = selectedItem.fillColor.model.toString(); // SPOT
var fillColorSpace = selectedItem.fillColor.space.toString(); // LAB
var l_value = selectedItem.fillColor.colorValue[0];
var a_value = selectedItem.fillColor.colorValue[1];
var b_value = selectedItem.fillColor.colorValue[2];
var l_float = parseFloat(l_value);
var a_float = parseFloat(a_value);
var b_float = parseFloat(b_value);
// Calculate CIE Chroma (C)
var chroma = Math.sqrt(Math.pow(a_value, 2) + Math.pow(b_value, 2));
// Calculate Hue Angle (H) in radians
var hue_radians = Math.atan2(b_value, a_value);
// Convert Hue Angle to degrees
var hue_degrees = (hue_radians * 180) / Math.PI;
if (hue_degrees < 0) {
hue_degrees += 360; // Make it positive
}
// Print the fill color details
alert("Fill Color:\n\n" +
"Color Model: " + fillModel + "\n" +
"Color Space: " + fillColorSpace + "\n" +
"L : " + l_value.toFixed(2) + "\n" +
"A : " + a_value.toFixed(2) + "\n" +
"B : " + b_value.toFixed(2) + "\n" +
"Chroma : " + chroma.toFixed(2) + "\n" +
"Hue Angle : " + hue_degrees.toFixed(2) + " degrees");
} else {
alert("The selected item does not have a fill color.");
}
} else {
alert("No item is currently selected.");
}