Color Picker DomError: RGB in 32 bits per channel precisions is currently not supported

When using the Color Picker with the cursor placed on the top right position of the color options window, I get the above error if I press the OK button and get the result, or part of it, to a variable.
To work around this, the cursor must be displaced from the top right position or the picker must be called, via the foreground/background icon with an HSB color with less then 100% saturation or less then 100% brightness, before calling the picker from the plugin .
If this problem is already known, please notify me to cancel this post

It is somewhat known. When I worked on some fixes for Color in DOM this was one of the issues. It was decided that support for 32bit colors will be added later. But sometimes you can get 32bit color even when your document is 8bit or 16bit.

I suggested automatic truncation of high-precision color to what we have now. But it did not pass. So at least we added an error to let users know what just happened.

So as a workaround you have to use batchPlay and check for grain together with greenFloat pick the one where you got number… do the math to adjust the value and then you can make your own SolidColor instance.

Tip… in float values… everything above 1 could be rounded to 1 which stands for 255 in non-float values.

Thank you for all the explanation but, this is way over my proficiency.
So I finally opted to reset foreground/background to black and white respectively before calling the color picker.

Yes. DOM needs to be improved so nobody would need to deal with it at all. If you document is in 8bit mode… you should not get any 32bit colors IMHO.

I am using an 8bit document with the following:

const getForegroundColor = async () => {
await exeModal( async () => {

		const result = await batchPlay(
		{ _obj: "showColorPicker",
			{ _ref: "application" }
			{ }
		const color = result[0].RGBFloatColor ?? null

		myRed = Math.round(
		myGreen = Math.round(color.grain)
		myBlue = Math.round(
		myHue = Math.round(app.foregroundColor.hsb.hue)
		mySat = Math.round(app.foregroundColor.hsb.saturation)
		myBright = Math.round(app.foregroundColor.hsb.brightness)

  console.log("getForegroundColor", myRed, myGreen, myBlue, myHue, mySat, myBright)

The error is provoked when reading part of the resulting color.