Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

ChoiceColorChanger

Summary: Provide a way of setting persistent skin color and theme choices when using the Choice skin.
Version: 2011-06-12
Prerequisites: Choice, Colorimetry, Skittlish skins installed
Status: Active
Maintainer: tamouse
Categories: Skins
Users: +1 (view / edit)

Questions answered by this recipe

All sections are optional, you can remove those that do not apply to your recipe, and add new ones.

Description

ChoiceColorChanger provides a means for a visitor to set different color and theme settings for the Choice, Colorimetry, and Skittlish skins.

Installation

Download choice-colorchanger.zipΔ and unzip in your cookbook directory.

Configuration

To enable choice-colorchanger, add the following to your config.php file:

        $EnableAutoSkinColorList = 1;
        include_once("$FarmD/cookbook/colorchange.php");

If you have other skins that follow the same scheme as Choice?, you can make a list of skins that will be acted on if they are set for the current skin:

        $ValidColorChangerSkins = array('choice','colorimetry','skittlish','mychoice','mycolorimetry','myskittlish');

will allow the additional use of localised versions of the given skins.

In addition, if you want to limit or map the available color schemes and themes, there are two hashes you can set:

To only allow a specific set of colors and themes, create an array called $PageColorList and $PageStyleList that maps names from ?color= or ?skintheme= into the corresponding skin to be used for that name. For example:

		$PageColorList = array(             # Only allow muted colors
			'blue_bold' => 'blue_muted',
			'green_bold' => 'green_muted',
                        'orange_bold' => 'orange_muted',
		);
		$PageStyleList = array(
			'light' => 'light',
			'dark' => 'light',               # Only allow light theme
		);

Usage

To use the recipe, once installed, add various query parameters to set color and theme:

color=colorscheme
sets the color scheme for the currently viewed page only. Will not persist to another page or view.
skintheme=theme
sets the skin theme (light or dark) for the currently viewed page only. Will not persist to another page or view.
setcolor=colorscheme
sets a cookie with the desired color scheme so it will persist throughout the user's visits.
setskintheme=theme
sets a cookie with the desired skin theme (light or dark) so it will persist throughout the user's visits.

Examples

The following query string will set the color sheme to blue_muted and the theme to dark for the current view:

        ?color=blue_muted&skintheme=dark

The following query string will set the color scheme to green_bold and the theme to light for all pages for this visitor:

        ?setcolor=green_bold&setskintheme=light

Notes

Future plans include developing some markup to insert a color scheme chooser so it can be easily embedded in a page somewhere.

It is possible to specify both the per-page and persistent options on the query string. Both will work, but the per-page set will take precedence (for that view only, then the persistent ones take over).

Change log / Release notes

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

See also

Choice, Colorimetry, Skittlish

Contributors

tamouse

Comments

See discussion at ChoiceColorChanger-Talk

User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on March 26, 2013, at 07:20 PM