RGB and Hexadecimal Codes in Text Layer
Hi,
I try to read Colors with Color Sampler at different positions an paste the colorcode in a text Layer.
RGB,LAB,HSB is no Problem
parseInt( foregroundColor.rgb.red)
parseInt( foregroundColor.hsb.hue)
parseInt( foregroundColor.lab.l)
but how i can get the Hexadecimal/Web Code?

#target photoshop
app.activeDocument.colorSamplers.removeAll();
var docRef = app.activeDocument
var pixelLoc = [UnitValue("1000 pixels") , UnitValue("240 pixels")];
var colorSamplerRef = docRef.colorSamplers.add(pixelLoc);
app.foregroundColor = colorSamplerRef.color
var doc = activeDocument;
var txtLayer = doc.layers.getByName('A1');
doc.activeLayer = txtLayer
txtLayer.textItem.contents = 'R: '+ parseInt( foregroundColor.rgb.red) + '\rG: ' + parseInt(foregroundColor.rgb.green) + '\rB: ' + parseInt(foregroundColor.rgb.blue) + '\rH: ' + parseInt(foregroundColor.rgb.hexvalue)var docRef = app.activeDocument
var pixelLoc = [UnitValue("1000 pixels") , UnitValue("240 pixels")];
var colorSamplerRef = docRef.colorSamplers.add(pixelLoc);
app.foregroundColor = colorSamplerRef.color
var doc = activeDocument;
var txtLayer = doc.layers.getByName('A2');
doc.activeLayer = txtLayer
txtLayer.textItem.contents = 'R: '+ parseInt( foregroundColor.rgb.red) + '\rG: ' + parseInt(foregroundColor.rgb.green) + '\rB: ' + parseInt(foregroundColor.rgb.blue)
