Gallery2:Modules:colorpack - Gallery Codex
Personal tools

Gallery2:Modules:colorpack

From Gallery Codex

ColorPack Module

Description

Adds the ability to change the color-scheme of some themes.

Usage

  • The color pack module must be installed and activated to use this module.
    • Site admin -> plugins

Colorpacks are used from the Themes configuration page either via the Site Admin or the individual Edit Album pages. When the module is installed and activated, compatible themes will display a "ColorPack" dropdown in their settings.

How to create new colorpacks

The module uses simple CSS files to control the theme appearance.

The easiest way to create a new colorpack is to make a copy of an existing pack and modify it.

The packs themselves are located in the gallery2/modules/colorpack/packs directory. Each colorpack has its own directory, and contains a single file named color.css.

Example color.css:

/* <?php $colorpackName = $gallery->i18n('Black'); ?>
 * $Revision: 1.3 $ $Date: 2005/08/03 07:05:00 $
 */

#gallery {
  color: #ffffff !important;
  background-color: #000000 !important;
}
body.gallery { background-color: #000000 !important; }

.gcBackground1 { background-color: #595959 !important; }
.gcBackground2 { background-color: #707070 !important; }

.gcBorder1 { border-color: #999999 !important; }
.gcBorder2 { border-color: #696969 !important; }

#gallery a { color: #00a0ff !important; }
#gallery a:hover { color: #cccc00 !important; }
#gallery a:active { color: #cccc00 !important; }

.giSuccess { color: #190 !important; }
.giWarning { color: #b31 !important; }
.giError { color: #d14 !important; }
.giInfo { color: #aaaaaa !important; }
.block-core-PeerList .current { color: #67b !important; }

table.gbDataTable th { background-color: #303030 !important; }
.gbEven { background-color: #707070 !important; }
.gbOdd { background-color: #505050 !important; }

#gallery select { background-color: #a0a0a0 !important; }
#gallery input { background-color: #a0a0a0 !important; }
#gallery textarea { background-color: #a0a0a0 !important; }

If you notice, the top of the file begins with a C++-style code comment that contains PHP tags. The purpose of this tag is to give Gallery the proper name of the pack to use in the user interface. For instance,

<?php $colorpackName = $gallery->i18n('Black'); ?>

You can name packs however you see fit. As a general rule, it is a good idea to name the pack directory similarly to the name of the pack itself.

For instance, the gallery2/modules/colorpack/packs/bluebottle directory contains the colorpack "Blue Bottle".

Not all colorpacks will work with all themes. The color combinations that look good on one, may look horrible on another, simply due to the way the colors are arranged on the page.

Setting a colorpack as default for a theme

Open the theme.inc file of your theme and search for the setStandardSettings array. Set the value of the colorpack element to the dirname of your colorpack.