<commit_before>/***
@title:
Colour Picker

@version:
2.0

@author:
<NAME>

@date:
2008-09-16

@url:
http://andreaslagerkvist.com/jquery/colour-picker/

@license:
http://creativecommons.org/licenses/by/3.0/

@copyright:
2008 <NAME> (andreaslagerkvist.com)

@requires:
jquery, jquery.colourPicker.css

@does:
Turns a drop-down (select-element) full of colours into a colour-picker-dialogue.

@howto:
jQuery('select[name="colour"]').colourPicker({ico: 'my-icon.gif', title: 'Select a colour from the list'}); Would replace the select with 'my-icon.gif' which, when clicked, would open a dialogue with the title 'Select a colour from the list'.

You can use this PHP-function to generate a list of "web-safe" colours:

[code]
function gwsc() {
	$cs = array('00', '33', '66', '99', 'CC', 'FF');

	for($i=0; $i<6; $i++) {
		for($j=0; $j<6; $j++) {
			for($k=0; $k<6; $k++) {
				$c = $cs[$i] .$cs[$j] .$cs[$k];
				echo "<option value=\"$c\">#$c</option>\n";
			}
		}
	}
}
[/code]

Use it like this: <select name="colours"><?php gwsc(); ?></select>.

@exampleHTML:
<p>
	<label>
		Pick a colour<br />
		<select name="colour_1">
			<option value="ffffff">White</option>
			<option value="ff0000">Red</option>
			<option value="00ff00">Green</option>
			<option value="0000ff">Blue</option>
			<option value="000000">Black</option>
		</select>
	</label>
</p>

<p>
	<label>
		And one more<br />
		<select name="colour_2">
			<option value="ffffff">White</option>
			<option value="ff0000">Red</option>
			<option value="00ff00">Green</option>
			<option value="0000ff">Blue</option>
			<option value="000000">Black</option>
		</select>
	</label>
</p>

@exampleJS:
jQuery('#jquery-colour-picker-example select[name="colour_1"], #jquery-colour-picker-example select[name="colour_2"]').colourPicker();
***/
jQuery.fn.colourPicker = function(conf) {
	// Config for plug
	var config = jQuery.extend({
		ID:			'colour-picker',	// ID of colour-picker container
		ico:		'ico.gif',			// SRC to colour-picker icon
		title:		'Pick a colour',	// Default dialogue title
		inputBG:	true,				// Whether to change the input's background to the selected colour's
		speed:		500					// Speed of dialogue-animation
	}, conf);

	// Inverts a hex-colour
	var hexInvert = function(hex) {
		return 'ffffff'; // Todo...

		var r = hex.substr(0, 2);
		var g = hex.substr(2, 2);
		var b = hex.substr(4, 2);
	};

	// Add the colour-picker dialogue if not added<commit_msg>Improve documentation<commit_after>/***
@title:
Colour Picker

@version:
2.0

@author:
<NAME>

@date:
2008-09-16

@url:
http://andreaslagerkvist.com/jquery/colour-picker/

@license:
http://creativecommons.org/licenses/by/3.0/

@copyright:
2008 <NAME> (andreasl<EMAIL>)

@requires:
jquery, jquery.colourPicker.css, jquery.colourPicker.gif

@does:
Turns a drop-down (select-element) full of colours into a colour-picker-dialogue.

@howto:
jQuery('select[name="colour"]').colourPicker({ico: 'my-icon.gif', title: 'Select a colour from the list'}); Would replace the select with 'my-icon.gif' which, when clicked, would open a dialogue with the title 'Select a colour from the list'.

You can use this PHP-function to generate a list of "web-safe" colours:

[code]
function gwsc() {
	$cs = array('00', '33', '66', '99', 'CC', 'FF');

	for($i=0; $i<6; $i++) {
		for($j=0; $j<6; $j++) {
			for($k=0; $k<6; $k++) {
				$c = $cs[$i] .$cs[$j] .$cs[$k];
				echo "<option value=\"$c\">#$c</option>\n";
			}
		}
	}
}
[/code]

Use it like this: <select name="colours"><?php gwsc(); ?></select>.

@exampleHTML:
<p>
	<label>
		Pick a colour<br />
		<select name="colour_1">
			<option value="ffffff">White</option>
			<option value="ff0000">Red</option>
			<option value="00ff00">Green</option>
			<option value="0000ff">Blue</option>
			<option value="000000">Black</option>
		</select>
	</label>
</p>

<p>
	<label>
		And one more<br />
		<select name="colour_2">
			<option value="ffffff">White</option>
			<option value="ff0000">Red</option>
			<option value="00ff00">Green</option>
			<option value="0000ff">Blue</option>
			<option value="000000">Black</option>
		</select>
	</label>
</p>

@exampleJS:
jQuery('#jquery-colour-picker-example select').colourPicker({ico: '/aFramework/Styles/__common/gfx/jquery.colourPicker.gif'});
***/
jQuery.fn.colourPicker = function(conf) {
	// Config for plug
	var config = jQuery.extend({
		ID:			'colour-picker',	// ID of colour-picker container
		ico:		'ico.gif',			// SRC to colour-picker icon
		title:		'Pick a colour',	// Default dialogue title
		inputBG:	true,				// Whether to change the input's background to the selected colour's
		speed:		500					// Speed of dialogue-animation
	}, conf);

	// Inverts a hex-colour
	var hexInvert = function(hex) {
		return 'ffffff'; // Todo...

		var r = hex.substr(0, 2);
		var g = hex.substr(2, 2);
		var b = hex.substr(4, 2);
	};

	// Add the colour-picker dialogue if not added
{'fraction_non_alphanumeric': 0.19091467157765502, 'fraction_numerical': 0.03192142418661756, 'mean_word_length': 3.9523809523809526, 'pattern_counts': {'":': 0, '<': 92, '<?xml version=': 0, '>': 86, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3269699', 'n_tokens_mistral': 2037, 'n_tokens_neox': 1793, 'n_words': 460}