CadQuery / cadquery

A python parametric CAD scripting framework based on OCCT
https://cadquery.readthedocs.io
Other
3.05k stars 284 forks source link

Color Mismatch with Input in STEP File #1411

Open derusermus opened 11 months ago

derusermus commented 11 months ago

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?

adam-urbanczyk commented 11 months ago

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?