Welcome Guest Search | Active Topics | Sign In | Register

ColorPicker control Options
apple
Posted: Wednesday, November 26, 2008 10:20:23 AM
Rank: Newbie
Groups: Member

Joined: 11/26/2008
Posts: 6
I want to display a different way of color selections instead of RGB and #6digits.
Such as named colors such as "red"
or a HTML color code chart etc such as http://html-color-codes.info/

Because it's very hard to choose a exact color such as blue from the provided ColorPicker by Mouse drag


eo_support
Posted: Wednesday, November 26, 2008 12:01:34 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

The color picker does not have built-in support for color names because many people do not use English color names. However it would make sense to provide a default translate map so that people will be able to either use that map directly, or modify the map for their own customized solutions. We will look into that and hopefully can post a new build to include this feature soon.

If you wish to use named color for the editor, you may wish to consider using a simple drop down box on the toolbar instead of the full featured color picker. In order to implement this, you will need to right click the Editor in design view, then select Edit Template -> CustomHeaderTemplate. That would fill the header template with the default toolbar. You would then switch to the HTML view to edit the toolbar to include a custom drop down:

Code: HTML/ASPX
<eo:Editor .....>
    .....
    <CustomHeaderTemplate>
        <eo:ToolBar ID="HeaderToolBar0" ....>
            <Items>
                 ....other toolbar buttons......
                 ......
                 <eo:ToolBarItem Type="Custom" CommandName="Color">
                     <CustomItem>
                         <select id="colorDropDown" 
                             onchange="onColorDropDownChanged()">
                             <option value="red">Red</option>
                             <option value="blue">Blue</option>
                             ......other color options.....
                         </select>
                     </CustomItem>
                 </eo:ToolBarItem>
            </Items>
            .....
        </eo:ToolBar>
        ....
    </CustomHeaderTemplate>
    ....
</eo:Editor>


Note the custom ToolBarItem that includes a HTML select element for various colors.

Code: JavaScript
function onColorDropDownChanged()
{
    //Get the selected color
    var cb = document.getElementById("colorDropDown");
    var color = cb.options[cb.selectedIndex].value;

    //Get the editor object
    var editor = eo_GetObject("Editor1");

    //Set the selection's foreground color
    editor.setStyle("color:" + color);    

    //You can also use the following code to set the selection's
    //background color
    //editor.setStyle("backgroundColor:" + color);
}


Hope this helps. We will post again once we added the color name table support.

Thanks
apple
Posted: Thursday, November 27, 2008 7:18:22 AM
Rank: Newbie
Groups: Member

Joined: 11/26/2008
Posts: 6
Thanks for considering of the feature implementation.
The color picker would not be a user friendly for those who post a message.
eo_support
Posted: Thursday, November 27, 2008 7:46:23 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
apple wrote:
The color picker would not be a user friendly for those who post a message.


Thank you very much for your feedback. But I am not sure whether I understand what you mean by "for those who post a message". Would you mind to explain what you mean by that?

Thanks!
apple
Posted: Thursday, November 27, 2008 8:35:22 AM
Rank: Newbie
Groups: Member

Joined: 11/26/2008
Posts: 6
normal users I mean
for example, the Editor can be in a bulletin on websites. several level of users can post a message and change font colors with the color picker.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.