The dialog displayed to the user when calling `answer color` allows the user to define custom colors (at least on OS X and Windows, don't know about Linux). On OS X the OS stores/restores the colors across sessions of an application by means of the app preference file. On Windows this is not the case and the colors only persist across calls to `answer color` in the same session.
The engine needs a way for the developer to store/restore the custom colors on Windows. Currently the code defines a state variable in w32ans.cpp on line 874:
Code: Select all
static variable static COLORREF custclr[16]; //save custom colors
I think the simplest approach would be to add a property that allowed you to set a CR delimited list of colors.
Code: Select all
set the colorDialogCustomColors to theListOfColors
The property would be updated to reflect the list of custom colors in the color dialog after the user closes it. This would allow the developer to store the value in preferences and have it persist across sessions.
Perhaps an ideal implementation would allow the developer to specify the custom colors for each call to `answer color`. Should `answer color` be extended to accept a list of colors to use as the custom ones? I imagine OS X allows you to configure the default colors as well.
Code: Select all
put "182,153,123" into theDefaultColor
put "245,245,245" & cr & "125,125,125" into theCustomColors
answer color with theDefaultColor with custom colors theCustomColors
If the developer doesn't provide a list of custom colors then `colorDialogCustomColors` would be used. If `colorDialogCustomColors` is empty then the OS defaults are used.
Thoughts?