cadquery icon indicating copy to clipboard operation
cadquery copied to clipboard

Color Mismatch with Input in STEP File

Open derusermus opened this issue 2 years ago • 1 comments

print(cq.Color('aliceblue').toTuple() == (.94,.97,1,1))

I think the above statement should return True, unless I am doing something wrong.

X11 Color Spec: https://en.wikipedia.org/wiki/X11_color_names

OpenCascade Uses X11 Color Spec: https://dev.opencascade.org/doc/refman/html/_quantity___name_of_color_8hxx.html#aadc2a1b709b06601041190b0a00c926aaf95b2f2152b5b664149575f43a349278

According to X11 spec which OCC uses for color AliceBlue should be 94, 97, 100 or normalized as (0.94, 0.97, 1.00, 1.00). When setting the color of an assembly using cq.Color('aliceblue') using the .toTuple() method of cq.Color gives (0.871366024017334, 0.9386860132217407, 1.0, 1.0). When writing this to a STEP file and exporting it causes the color to be off in the STEP file. Is there a way of getting these values correct?

derusermus avatar Oct 01 '23 01:10 derusermus

It something likely regarding sRGB vs linear RGB (see https://dev.opencascade.org/content/step-colours-regressionchange).

What do you mean with STEP colors being off actually? E.g. off with respect to linear RGB or sRGB?

adam-urbanczyk avatar Oct 01 '23 08:10 adam-urbanczyk