Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Color Picker Control for your Web site � A HTML Component (HTC)

28 Jun 2003 1  
Color Picker Control for your Web site � A HTML Component (HTC)

Sample Image - WebPalette.png

Sample image - NamedColors.png

Sample image - SystemColors.png

Sample image - CustomColor.png

Introduction

When I look at the code project articles for color picker control, it has bunch of excellent color picker controls but all are rich-client controls written in MFC, .NET, etc. But no one has written for web environments (thin-clients). If I search web for free �web based� color picker controls, I have to invest lot of money for this. Some sites are providing the controls freely but not looking good. So, here I have tried my best to implement color picker control for web environments. This Color picker control is fully written as a HTC component by using HTML and DHTML.

To learn about HTC please visit:

Special Features

  • Fully functional at client side (pure thin client) and no round trips to the server
  • Reusable HTC Component. So it takes all the advantages of HTC
  • Advanced controls like Tab Control, Tab Pages, Sliders are implemented in this HTC as a normal html pages
  • Look and Feel UI for picking all types of color combinations
  • Color navigations divided into four different regions such as Web palette, Named colors, system colors, custom color (exactly like a Visual Studio.NET IDE Color Picker style)
  • All controls are created at run time and optimized for speed
  • Full "interactive help" like tool tips, descriptions provided to all tab pages

Limitation

At present, only IE 5.0 or later browsers support this HTC technology. Microsoft is still waiting for World Wide Web Consortium adoption. So, to successfully deploy this control on a Web site, a browser detection routine is required to ensure the user is running a version of IE 5.0 or later before launching the components.

Files

This control pack contains the following 4 files :-

  • ColorPicker.htc : Core component contains all business logic implemented by myself.
  • ColorPicker.htm : Html page will be displayed in dialog box and it has one instance of the above ColorPicker.htc component.
  • mpc.htc : Multipage control (tab control for web) implemented by Microsoft
  • MyWebPage.htm : Sample web page using color picker control
     

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here