Section Colors

Color utility functions.

Summary

Return typeFunction and summary
string, string, intChooseColor(string object, table suggestedColors, selected)
Ask the user to choose one color in a menu.

Function

ChooseColor(string object, table suggestedColors, selected)

Ask the user to choose one color in a menu.

Choose staff line color, there are 5 favorites
If available, the list starts by a list of favorites colors, saved by previous choices for the same object (e.g. "Staff background").
Then, a list of suggested colors (e.g. found in score).
Then, the ability to pick a new color from the Color Picker, and save it to favorites for faster use next times.

ParameterTypeDefaultDescription
objectstring The name you want, e.g. "Staff background", "Staff lines"...
suggestedColorstablenilA table of string in [#]RRGGBB format (recommanded), or number color index
selected  A string in [#]RRGGBB format or number color index
Returns
string: Choosen color, in RRGGBB format, or nil if user canceled the choice.
string: Choosen color, in #RRGGBB format, or nil if user canceled the choice.
int: Color index, or nearest in 256 colors palette, or nil if user canceled the choice.