Detect the activated theme from plugin code

You can use wp_get_theme to get current theme object.

$current_theme = wp_get_theme();

And it will return WP_Theme object.