Preview Theme functionality in Cakephp3

In my AppController i’m assigning the active theme like this:

$this->viewBuilder()->theme($this->Themes->active_theme());

I’ve created a page which shows all my themes (I’m using a json file for this), i want to add a preview theme functionality to every theme in my page just like wordpress, drupal etc.

I’m not sure how to can i temporarily load a theme using app controller for previewing purpose.

Any help on how this functionality works and how can i do it in Cakephp would save my day.