Expression painter:currentmode() returns a string representing the current composition mode.
painter:currentmode()