Codex tools: Log in
switch_theme is triggered when the blog's theme is changed.
<?php add_action('switch_theme', 'on_switch_theme_function'); ?>