optimized button handler for theme change