diff --git a/action/toolbar.php b/action/toolbar.php
new file mode 100644
index 0000000..0e93657
--- /dev/null
+++ b/action/toolbar.php
@@ -0,0 +1,67 @@
+
+ */
+// must be run within Dokuwiki
+if(!defined('DOKU_INC')) die();
+
+/**
+ * Class action_plugin_cellbg_toolbar
+ */
+class action_plugin_cellbg_toolbar extends DokuWiki_Action_Plugin {
+
+ /**
+ * Register event handlers.
+ *
+ * @param Doku_Event_Handler $controller The plugin controller
+ */
+ public function register(Doku_Event_Handler $controller) {
+ if($this->getConf('toolbar_icon')) $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insert_toolbar_button', array ());
+ }
+
+ /**
+ * Inserts the cellbg toolbar button
+ */
+ function insert_toolbar_button(Doku_Event &$event, $param) {
+ $defaultColors = array( 'Yellow' => 'yellow',
+ 'Red' => 'red',
+ 'Orange' => 'orange',
+ 'Salmon' => 'salmon',
+ 'Pink' => 'pink',
+ 'Plum' => 'plum',
+ 'Purple' => 'purple',
+ 'Fuchsia' => 'fuchsia',
+ 'Silver' => 'silver',
+ 'Aqua' => 'aqua',
+ 'Teal' => 'teal',
+ 'Cornflower'=> '#6495ed',
+ 'Sky Blue' => 'skyblue',
+ 'Aquamarine'=> 'aquamarine',
+ 'Pale Green'=> 'palegreen',
+ 'Lime' => 'lime',
+ 'Green' => 'green',
+ 'Olive' => 'olive'
+ );
+ $custom_colors = array();
+ if($this->getConf('custom_colors'))
+ {
+ $custom_colors_lines = explode(DOKU_LF, $this->getConf('custom_colors'));
+ foreach ($custom_colors_lines as $line) {
+ list($colerName, $color) = explode('=', $line);
+ $custom_colors[$colerName] = $color;
+ }
+ }
+ $event->data[] = array (
+ 'type' => 'CellbgPicker',
+ 'title' => $this->getLang('toolbar_icon'),
+ 'icon' => '../../plugins/cellbg/images/cellbg-toolbar.png',
+ 'open' => '@#',
+ 'colorlist' => array_merge($defaultColors, $custom_colors),
+ 'sample' => 'RRGGBB',
+ 'close' => ':'
+ );
+ }
+}
\ No newline at end of file
diff --git a/conf/default.php b/conf/default.php
new file mode 100644
index 0000000..9733720
--- /dev/null
+++ b/conf/default.php
@@ -0,0 +1,6 @@
+
+ */
+
+$meta['toolbar_icon'] = array('onoff');
+$meta['custom_colors'] = array('');
diff --git a/images/cellbg-toolbar.png b/images/cellbg-toolbar.png
new file mode 100644
index 0000000..1cb0730
Binary files /dev/null and b/images/cellbg-toolbar.png differ
diff --git a/images/cellbg.png b/images/cellbg.png
deleted file mode 100644
index 54c025e..0000000
Binary files a/images/cellbg.png and /dev/null differ
diff --git a/images/gradient.png b/images/gradient.png
new file mode 100644
index 0000000..38c7419
Binary files /dev/null and b/images/gradient.png differ
diff --git a/lang/cs/lang.php b/lang/cs/lang.php
new file mode 100644
index 0000000..e12493b
--- /dev/null
+++ b/lang/cs/lang.php
@@ -0,0 +1,12 @@
+
+ */
+
+// custom language strings for the plugin
+$lang['toolbar_icon'] = 'Vložit Cellbg-Syntaxi';
+
+//Setup VIM: ex: et ts=2 enc=utf-8 :
diff --git a/lang/cs/settings.php b/lang/cs/settings.php
new file mode 100644
index 0000000..d4da796
--- /dev/null
+++ b/lang/cs/settings.php
@@ -0,0 +1,11 @@
+
+ */
+
+// for the configuration manager
+$lang['toolbar_icon'] = 'Zobrazit toolbar ikonku (pokud se nezobrazuje, smažte data/cache/* a cache prohlížeče)';
+$lang['custom_colors'] = 'Uživatelsky definované barvy.
Název barvy následován znakem = a textem barvy či kódu barvy.
Příklad:Barva 1=green
';
diff --git a/lang/en/lang.php b/lang/en/lang.php
new file mode 100644
index 0000000..76b3f3f
--- /dev/null
+++ b/lang/en/lang.php
@@ -0,0 +1,10 @@
+
+ */
+
+// custom language strings for the plugin
+$lang['toolbar_icon'] = 'Insert Cellbg-Syntax';
diff --git a/lang/en/settings.php b/lang/en/settings.php
new file mode 100644
index 0000000..3012d0d
--- /dev/null
+++ b/lang/en/settings.php
@@ -0,0 +1,11 @@
+
+ */
+
+// for the configuration manager
+$lang['toolbar_icon'] = 'Show toolbar icon (clear data/cache/* and browser cache if it\'s not displayed)';
+$lang['custom_colors'] = 'Custom colors definitions.
Barva 2=#002244
The color name, followed by a an equals sign and a text color name or color code.
Example:Color 1=green
';
diff --git a/script.js b/script.js
index adfed10..aef3068 100644
--- a/script.js
+++ b/script.js
@@ -1,112 +1,71 @@
/* JavaScript function to create cellbg toolbar in DokuwKki */
-/* see http:// for more info */
-
-var plugin_cellbg_colors = {
-
- "Yellow": "yellow",
- "Red": "red",
- "Orange": "orange",
- "Salmon": "salmon",
- "Pink": "pink",
- "Plum": "plum",
- "Purple": "purple",
- "Fuchsia": "fuchsia",
- "Silver": "silver",
- "Aqua": "aqua",
- "Teal": "teal",
- "Cornflower": "#6495ed",
- "Sky Blue": "skyblue",
- "Aquamarine": "aquamarine",
- "Pale Green": "palegreen",
- "Lime": "lime",
- "Green": "green",
- "Olive": "olive"
- //"Yellow": "#ffff00",
- //"Red": "#ff0000",
- //"Orange": "#ffa500",
- //"Salmon": "#fa8072",
- //"Pink": "#ffc0cb",
- //"Plum": "#dda0dd",
- //"Purple": "#800080",
- //"Fuchsia": "#ff00ff",
- //"Silver": "#c0c0c0",
- //"Aqua": "#00ffff",
- //"Teal": "#008080",
- //"Cornflower": "#6495ed",
- //"Sky Blue": "#87ceeb",
- //"Aquamarine": "#7fffd4",
- //"Pale Green": "#98fb98",
- //"Lime": "#00ff00",
- //"Green": "#008000",
- //"Olive": "#808000"
-
-};
-
-function plugin_cellbg_make_color_button(name, value) {
-
- var btn = document.createElement('button');
-
- btn.className = 'pickerbutton';
- btn.value = '';
- btn.title = name;
- btn.style.height = '2em';
- btn.style.padding = '1em';
- btn.style.backgroundColor = value;
-
- var open = "@" + value + ":";
- eval("btn.onclick = function(){ insertAtCarret( '"
- + jsEscape('wiki__text') + "','"
- + jsEscape(open) + "','"
- + "'); return false; } "
- );
-
- return(btn);
-
-}
-
-function plugin_cellbg_toolbar_picker() {
-
- if (!document.getElementById('spell__action')) return;
+/* see https://www.dokuwiki.org/devel:toolbar for more info */
+
+function createCellbgPicker(id, props, edid) {
+ // create the wrapping div
+ var $picker = jQuery(document.createElement('div'));
+
+ $picker.addClass('picker a11y');
- var toolbar = document.getElementById('tool__bar');
- if (!toolbar) return;
-
- // Create the picker button
- var p_id = 'picker_plugin_cellbg'; // picker id that we're creating
- var p_ico = document.createElement('img');
- p_ico.src = DOKU_BASE + 'lib/plugins/cellbg/images/cellbg.png';
- var p_btn = document.createElement('button');
- p_btn.className = 'toolbutton';
- p_btn.title = 'Cell background';
- p_btn.appendChild(p_ico);
- eval("p_btn.onclick = function() { showPicker('"
- + p_id + "',this); return false; }");
-
- // Create the picker
Color 2=#002244
Color 2=#ABC