Implement API for setting styles with a function