Documentation

End Users

Theme developers have to make their themes compatible with this addon for you to this addon to be useful.  

To use, simply go to the dashboard=>coloring boxes. Select a theme that you wish to modify, and select the new color scheme from the dropdown.

Once you have done this and saved, go to dashboard->themes. Click the customize button next to the theme that you selected the new color scheme for. The colors for this theme have been updated. You can change them around to your liking. Once you are done customizing further, go back to the themes page and activate the theme that you have customized.

To go back to the default scheme, simple go to the customize page for the theme and hit the reset to defaults button.

Designers

A sample theme is available for download.

All the logic should be located in your themes controller.php file in the install and uninstall functions. Heres how it works.

The first step is the easiest. Assign the variable to to the installed theme. Usually we use

PageTheme::add('yogurt', $pkg);

to install themes, but here we want this.

$t=PageTheme::add('yogurt', $pkg);

Next, we want to check if coloring book is installed. We do this by

$coloringBox = Package::getByHandle('jacks_theme_coloring_book'); 
if (isset($coloringBox)) {
 
}

Now, all the code inside the is_object check will be executed if the theme is installed. First, we want to load the model inside the is_object check.

loader::model('theme_coloring_book', 'jacks_theme_coloring_book');

Finally, we need to actually install the color scheme or "coloring book"

ThemeColoringBook::addCrayonBox($t,'black',array(
'background'=>'#000000',
'bodyfont'=>'normal|normal|15|Arial',
'body'=>'#777777',
'header_logo'=>'#999',
'link'=>'#66aa33',
'link_hover'=>'#66CC00',
'miscellaneous'=>''));

Theres a lot going on here, so lets go through step by step. The actual function we call, ThemeColoringBook::addCrayonBox, has three parameters. The first is the theme that has these color schemes associated with it. We supply that with the $t variable that we set earlier and is the result of installing the theme.

The next parameter is the name of the color scheme. In this case, it is black.

The last parameter is the most complicated. This is an associative array of all the customizable styles available. When you are making a customizable style the format is something like this /* customize_link */ What you want as the key of each array value (or what is on the left of the =>, like body, header_logo, and link) is whats after customize_ . Whats on the right of the array value (or after the =>) is the value that this customizable style should be. So if this was the code in your css

a:hover { /* customize_link_hover */ color: #66CC00; /* customize_link_hover */ }

and you wanted the a:hover for the color scheme to be black, you'd put this in the array.

'link_hover'=>'#000000',

Theres one other exception. If you want to use customizable fonts, then you have to put font after the name of the customizable style. Theres also a special syntax. So to set

body { /* customize_body */ font: normal normal 13px Arial; /* customize_body */ }

to use helvetica, bold, italics, and size 16 font you'd use

'bodyfont'=>'italic|bold|16|Helvetica',

If you want non bold, then simple change bold to normal.

'bodyfont'=>'italic|nortmal|16|Helvetica',

You don't have to have every available customizable style in your array. If one isn't in the array then the style will stay as it was before the color scheme change.

To uninstall the theme, simple use this code.

 

 $t=PageTheme::getByHandle('your_theme_handle');
 $coloringBox = Package::getByHandle('jacks_theme_coloring_book');
 if (isset($coloringBox)) { 
 loader::model('theme_coloring_book', 'jacks_theme_coloring_book');
 ThemeColoringBook::removeCrayonBoxes($t); 
 parent::uninstall();

My apoligies if this is confusing. If you don't understand it please take a look at the demo plain yogurt and don't hesitate to ask questions in the support forum.