diff options
author | Zach Copley <zach@controlyourself.ca> | 2009-06-15 22:27:59 -0700 |
---|---|---|
committer | Zach Copley <zach@controlyourself.ca> | 2009-06-15 22:27:59 -0700 |
commit | 4652f316cf9cb94fb5f0ae8003d7bb9e2bdcdaee (patch) | |
tree | 46d283f6a247574b6620411af059a34d14af6841 /classes/Design.php | |
parent | ef99f83963ba598b1e52224ce80a7d8a8e84a96f (diff) |
Design class now uses WebColor class for outputting hex colors
Diffstat (limited to 'classes/Design.php')
-rw-r--r-- | classes/Design.php | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/classes/Design.php b/classes/Design.php index 4f6b2a844..9bfdcd1c3 100644 --- a/classes/Design.php +++ b/classes/Design.php @@ -17,13 +17,16 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('LACONICA')) { + exit(1); +} /** * Table Definition for design */ -require_once INSTALLDIR.'/classes/Memcached_DataObject.php'; +require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; +require_once INSTALLDIR . '/lib/webcolor.php'; class Design extends Memcached_DataObject { @@ -47,11 +50,25 @@ class Design extends Memcached_DataObject function showCSS($out) { + try { + + $bgcolor = new WebColor($this->backgroundcolor); + $ccolor = new WebColor($this->contentcolor); + $sbcolor = new WebColor($this->sidebarcolor); + $tcolor = new WebColor($this->textcolor); + $lcolor = new WebColor($this->linkcolor); + + } catch (WebColorException $e) { + // This shouldn't happen + common_log(LOG_ERR, "Unable to create color for design $id.", + __FILE__); + } + $out->element('style', array('type' => 'text/css'), - 'body { background-color: #' . dechex($this->backgroundcolor) . '} '."\n". - '#content { background-color #' . dechex($this->contentcolor) . '} '."\n". - '#aside_primary { background-color #'. dechex($this->sidebarcolor) .'} '."\n". - 'html body { color: #'. dechex($this->textcolor) .'} '."\n". - 'a { color: #' . dechex($this->linkcolor) . '} '."\n"); + 'body { background-color: #' . $bgcolor->hexValue() . '} '."\n". + '#content { background-color #' . $ccolor->hexValue() . '} '."\n". + '#aside_primary { background-color #'. $sbcolor->hexValue() .'} '."\n". + 'html body { color: #'. $tcolor->hexValue() .'} '."\n". + 'a { color: #' . $lcolor->hexValue() . '} '."\n"); } } |