PHP Classes

File: readme.md

Recommend this page to a friend!
  Classes of Gerry Danen  >  Theme Roller  >  readme.md  >  Download  
File: readme.md
Role: Documentation
Content type: text/markdown
Description: documentation
Class: Theme Roller
Generate CSS stylesheets with color palette themes
Author: By
Last change: Updated documentation
Date: 6 years ago
Size: 3,095 bytes
 

Contents

Class file image Download

Theme Roller

Version 1.0.1 23 May 2016

Theme Roller creates CSS style sheets on the fly. Palettes for the chosen theme are created, as well as "all-color" palettes.

Components to make Theme Roller work: * themeRoller.class.php - the class file * sample.php - sample script to test functionality * sample2.php - sample script to test functionality * theme.php - the generated CSS style sheet (output as a CSS string) * themeStrings.php - like theme.php, but this file exposes certain variables that may come in handy in debugging * themeContent.php - the CSS directives go here; used by theme.php and themeStrings.php * readme.md - instructions

themeRoller.class.php

There are 2 static functions for use: * selectTheme() - checks $_SESSION['theme']['choice'] to get the desired theme code; if not found, the designated default code is returned. * themeOptionSelect() - returns a list of theme options to select from

Instantiate the Theme Roller object like this:

> $roller = new ThemeRoller($theme, 'Colour theme: {{theme-title}}');

where $theme is the theme code (can be obtained from selectTheme() or set specifically) and the second parameter is the title that will go in the CSS file.

Functions available:

  • ->addSelector(selector, comment) * selector, like 'body', '.className', or '#idName' * comment (optional), selector comment
  • ->addRule(rule, value) * rule, like 'color', or 'background-color' * value, like '#E8ECFF'
  • ->getThemeDefValue(definition) * definition, like 'color', or 'background-color'
  • ->generateCSS() * generates CSS, and palette files

themeContent.php

This file contains the rules to generate the CSS styles.

Debug functionality

Comprehensive debug functionality is built in. This is also useful for learning how the class works internally. Make sure the debug directory is writeable. Currently set to /data/debug/, you may change that to suit your needs.

License

The MIT License (MIT)

Copyright (c) 2016 Gerry Danen

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information send a message to info at phpclasses dot org.