==README for Color Picker add-on for miniBB==
Release date: February 6, 2008.
Last update: November 25, 2025.
miniBB version: 3.3 and up
Author: Paul Puzyrev (minibb.com)

This add-on provides possibility to apply BB color tag in your post. Highlight the text in the message area, pick the color, and it will automatically become enclosed in a proper tag. It is possible to specify set of your own colors, extending what is provided by default. 


==SETUP==

Open addon_bbcolor.php in an ASCII plain text editor and locate/edit/save the following variable settings:

$splitRow - defines the color picking square units displayed in one row; 0 by default means there's just a single row of colors. This is only useful for "thin" forms where the width is critical. For example, if you leave the default values, you will have the set of colors of the 320px in width (16 x 20). If it appears to wide, you could set $splitRow=8 and then 16 colors will be split into 2 rows having 8 x 20 = 160 px in width.

$colorsArray - defines array of all possible colors; use the format as suggested, providing all colors in HEX format _without_ leading #. By default, there is set of 16 different colors for the desktop version, and reduced amount for the responsive/mobile mode.

$sq - amount in pixels defining width and height of the color picking square unit

You may leave this all by default as well, as it has been tested and proved live for many applications and could work without extra modifications.


==INSTALLATION==


* copy addon_bbcolor.php to your forums folder.


* copy img/button_color.svg to your /img/ folder of forums (this image will stand for "BB color button" in the buttons set) 


* in bb_plugins.php, paste the code provided in bb_plugins.code.txt. Note: bb_plugins.code needs to be pasted AFTER /* 1st page & separate topic form addon */ if you have it installed.


* It is preferred that in your language pack (lang/eng.php or whatever) you define/translate the variable located under /lang/eng.code.txt (or the related language snippet). This value will appear as alternative title tag for "BB color" button image when you mouse over it.


* in templates/main_post_form.html template, paste the following:

- {$button_color_picker} - will be replaced to the BB code image button; paste in the section where all other BB-code buttons reside;

- {$color_picker_block}{$color_picker_js} - will be replaced to the Colors appearance layer, as well as the JavaScript function to handle the color selection. These tags should be preferrably pasted closer to the message text area's code, so they appear right above it. If you are using the Smileys add-on, we would recommend to install this code AFTER the code for Smileys.

(All the tags above are set in bb_plugins.php)


* by default, miniBB is not allowing to use color BB code for regular users (but for admin/moderators only). You would need to modify bb_codes.php file and remove the condition which looks like:

if($admin==1 or $GLOBALS['isMod']==1){

$pattern[]="/\[font(#[A-F0-9]{6})\](.+?)\[\/font\]/is";
$replacement[]='<span style="color:\\1">\\2</span>';

}

putting the pattern/replacement  *out of this condition* will enable the code working for all users.

The same way, remove or comment this condition from bb_plugins.php.



==USAGE==

When you post a new topic, new message or edit a message, highlight the text and click "BB color" button. It should open the bottom layer with the selection of colors. Picking up the color should bring your highlighted text surrounded with default BB color tags which are supported by miniBB by default.


==NOTES==

* If you would like to avoid intermediate steps clicking on "BB color" button, and would like to see the colors bar available straight above the message text area, in bb_plugins.php code specify:

pickerShow=true;

OR remove the JavaScript function and set:

<div id="colorpick" style="display:block;">


==FINALLY==
Questions? Suggestions? Improvements? Post them quickly on our support forums:
http://www.minibb.com/forums/11_5134_1.html
