Forground Color not accurate

I am trying to retrieve the Foregroundcolor in Photoshop and have found that when using this method

app.foregroundColor.rgb

{
    "desc": {
        "_obj": "HSBColorClass",
        "hue": {
            "_unit": "angleUnit",
            "_value": 128.4686279296875
        },
        "saturation": 54.90196078431372,
        "brightness": 47.84313725490196
    }
}
blue: undefined
green: undefined
hexValue: "ANANAN"
red: undefined
typename: "RGBColor"

the RGB values are undefinded.

When i get the color over a batchplay:

const color = await action.batchPlay([{
          _obj: "get",
          _target: [
             {
                _ref: "application",
                _enum: "ordinal",
                _value: "targetEnum"
             }
          ],
          _options: {
             dialogOptions: "dontDisplay"
          }
     }], 
{});

I get this value:

{
    "_obj": "RGBColor",
    "red": 55.00389105058366,
    "grain": 122,
    "blue": 64
}

Which is not always 100% accurate with the values shown in the color picker.

is there a way to get exactly the color that is listed in the picker?

It would help everyone if you formatted the code with ``` before and after code blocks

thanks for the tip i did not know that