This is a migrated thread and some comments may be shown as answers.

CurrentColorText for KnownColor(s)

3 Answers 81 Views
ColorPicker
This is a migrated thread and some comments may be shown as answers.
Terry
Top achievements
Rank 1
Terry asked on 23 Jul 2008, 07:32 AM
Hi

How can I get the CurrentColorText (defaults to '(Current Color is {0})', to display the colour name rather than the hex value  in {0} ???

Shame question for preview too so I would like to see...

'Your team colour is Yellow' not 'Your team colour is FF66C3' etc.

Terry

3 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 23 Jul 2008, 01:26 PM
Hi Terry,

I am afraid this is not possible. RadColorPicker is designed to use HTML colors and it outputs the color names in hex format. If it used real names, the number of colors would have been very limited.


Kind regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Bryan
Top achievements
Rank 1
answered on 10 Sep 2010, 04:34 PM
Sorry to dredge up an old post, but has this been changed? The documentation for the RadColorPicker clearly says, "The color may display as a color name or a hexadecimal string." and yet I can find no way of setting this.
0
Rumen
Telerik team
answered on 15 Sep 2010, 12:33 PM
Hi Bryan,

You can display the selected color's title using the get_selectedColorTitle() method, but you cannot convert the hexadecimal strings to color names, because as Georgi already mentioned the HTML color names are limited.

You can define your own set of colors which offer HTML color names and get their names using the get_selectedColorTitle method:

<script type="text/javascript">
    function colorChange(sender, eventArgs) {
        var myDiv = document.getElementById("myDiv");
        myDiv.innerHTML = 'Color name is ' + sender.get_selectedColorTitle();
    }
</script>
<Telerik:RadColorPicker ID="RadColorPicker1" runat="server" Preset="None" OnClientColorChange="colorChange">
    <Telerik:ColorPickerItem Title="Red" Value="#FF0000" />
    <Telerik:ColorPickerItem Title="Green" Value="#00FF00" />
    <Telerik:ColorPickerItem Title="Blue" Value="#0000FF" />
</Telerik:RadColorPicker>
<div id="myDiv"></div>


Sincerely yours,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
ColorPicker
Asked by
Terry
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Bryan
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or