From e422a60a9672c993b6872e856b9172dbd8135b56 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sun, 17 May 2015 15:37:50 +0200 Subject: added color picker support I'm not too hapy with it --- lib/plugins/styler/admin.php | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'lib/plugins/styler/admin.php') diff --git a/lib/plugins/styler/admin.php b/lib/plugins/styler/admin.php index bfc6cd32b..8d44ac6f5 100644 --- a/lib/plugins/styler/admin.php +++ b/lib/plugins/styler/admin.php @@ -84,7 +84,7 @@ class admin_plugin_styler extends DokuWiki_Admin_Plugin { foreach($replacements as $key => $value) { echo ''; echo ''.$key.''; - echo ''; + echo 'colorClass($key).' />'; echo ''; } echo ''; @@ -107,6 +107,32 @@ class admin_plugin_styler extends DokuWiki_Admin_Plugin { } } + /** + * set the color class attribute + */ + protected function colorClass($key) { + static $colors = array( + 'text', + 'background', + 'text_alt', + 'background_alt', + 'text_neu', + 'background_neu', + 'border', + 'highlight', + 'background_site', + 'link', + 'existing', + 'missing', + ); + + if(preg_match('/colou?r/', $key) || in_array(trim($key,'_'), $colors)) { + return 'class="color"'; + } else { + return ''; + } + } + /** * saves the preview.ini */ -- cgit v1.2.3