CodeIgniter Forums
Theme Manager Library - Printable Version

+- CodeIgniter Forums (
+-- Forum: CodeIgniter 4 (
+--- Forum: CodeIgniter 4 Addins (
+--- Thread: Theme Manager Library (/showthread.php?tid=73899)

Theme Manager Library - MGatner - 06-20-2019

Hi all- I found myself trying to force a few tools to do what they weren't made to do in order to get user-selectable themes working. I cobbled together a new solution that I thought I would share in case anyone else was interested:

Tatter/Themes - Lightweight user themes for CodeIgniter 4

Basic usage:

1. Install with Composer: `> composer require tatter/themes`
2. Update the database: `> php spark migrate:latest -all`
3. Seed the database: `> php spark db:seed \\Tatter\\Themes\\Database\\Seeds\\ThemeSeeder`
4. Place theme files in public/themes/default
5. Add theme files to your page, e.g.: `echo view('\Tatter\Themes\Views\css)`

There are CLI commands to list and add new themes (`> spark themes:add`), and some helper functions and routes to make it easy for users to select a new theme (`theme_form()`). I'm using this library already to add a dark theme option to an existing CodeIgniter 4 site.

The Themes library uses Tatter/Settings so user theme choices will persist across sessions and are fast to configure and load.

Thanks for reading! I'm always glad for feedback and suggestions, feel free to leave a comment here or check out the repo at