Customizing Color Picker

Rich Text Editor for PHP

Copy imageCopyHover image

The Colors Panel of RichTextEditor by default displays a predefined set of colors. The colors are defined in the configuration file (richtexteditor\scripts\config.js). You can easily modify this default set by inserting a piece of Javascript code into the page or modify the color array in the configuration file directly.

Default Colors

CopyCode imageCopy Code
colorpicker_forecolor	:	["#000000","#993300","#333300","#003300","#003366","#000080","#333399","#333333",
		"#800000","#ff6600","#808000","#008000","#008080","#0000ff","#666699","#808080",
		"#ff0000","#ff9900","#99cc00","#339966","#33cccc","#3366ff","#800080","#999999",
		"#ff00ff","#ffcc00","#ffff00","#00ff00","#00ffff","#00ccff","#993366","#c0c0c0",
		"#ff99cc","#ffcc99","#ffff99","#ccffcc","#ccffff","#99ccff","#cc99ff","#ffffff"],
colorpicker_backcolor	:	["#000000","#993300","#333300","#003300","#003366","#000080","#333399","#333333",
		"#800000","#ff6600","#808000","#008000","#008080","#0000ff","#666699","#808080",
		"#ff0000","#ff9900","#99cc00","#339966","#33cccc","#3366ff","#800080","#999999",
		"#ff00ff","#ffcc00","#ffff00","#00ff00","#00ffff","#00ccff","#993366","#c0c0c0",
		"#ff99cc","#ffcc99","#ffff99","#ccffcc","#ccffff","#99ccff","#cc99ff","#ffffff"],
colorpicker_othercolor	:	["#000000","#993300","#333300","#003300","#003366","#000080","#333399","#333333",
		"#800000","#ff6600","#808000","#008000","#008080","#0000ff","#666699","#808080",
		"#ff0000","#ff9900","#99cc00","#339966","#33cccc","#3366ff","#800080","#999999",
		"#ff00ff","#ffcc00","#ffff00","#00ff00","#00ffff","#00ccff","#993366","#c0c0c0",
		"#ff99cc","#ffcc99","#ffff99","#ccffcc","#ccffff","#99ccff","#cc99ff","#ffffff"],           

Defining Colors In-Page

You can easily modify this default set by creating your own color array by using RichTextEditor_OnLoader event.

CopyCode imageCopy Code
function RichTextEditor_OnLoader(loader)
{
    loader._config.colorpicker_forecolor=["#FF0000","#FF9900","#99CC00","#339966","#33CCCC","#3366FF","#800080","#999999",
"#FF00FF","#FFCC00","#FFFF00","#00FF00","#00FFFF","#00CCFF","#993366","#C0C0C0"];
    loader._config.colorpicker_backcolor=["#FF0000","#FF9900","#99CC00","#339966","#33CCCC","#3366FF","#800080","#999999",
"#FF00FF","#FFCC00","#FFFF00","#00FF00","#00FFFF","#00CCFF","#993366","#C0C0C0"];
    loader._config.colorpicker_othercolor=["#FF0000","#FF9900","#99CC00","#339966","#33CCCC","#3366FF","#800080","#999999",
"#FF00FF","#FFCC00","#FFFF00","#00FF00","#00FFFF","#00CCFF","#993366","#C0C0C0"];
}           


Send feedback about this topic to CuteSoft. © 2003 - 2012 CuteSoft Components Inc. All rights reserved.