For a pure LT solution, you can use the layer.cmap object to read out every single level value and color, build a wks, and export it.
https://www.originlab.com/doc/LabTalk/ref/Layer-CMap-obj
For Python, you can try something like this (since you're using 9.6):
import PyOrigin
# Assume there is a contour graph been activated
ColorLevels = int(PyOrigin.LT_get_var('layer.cmap.numColors'))
ListR, ListG, ListB = ([None]*ColorLevels for i in range(3))
for ColorInd in range(ColorLevels):
Ocolor = PyOrigin.LT_get_var("layer.cmap.color{0}".format(ColorInd))
PyOrigin.LT_execute("int var = ocolor2rgb({0})".format(Ocolor))
RGB = PyOrigin.LT_get_var('var')
ListR[ColorInd], ListG[ColorInd], ListB[ColorInd] = [float((int(RGB) >> (8*i)) & 255) / 255 for i in range(3)]
with open("ColorPaletteSample.pal", "w") as f:
for ColorInd in range(ColorLevels):
f.write("{0},{1},{2}\n".format(ListR[ColorInd], ListG[ColorInd], ListB[ColorInd]))