revised palette API, courtesy of Roberto Togni (rtogni at freemail.it)