From: "Ralf Mimoun" Newsgroups: borland.public.delphi.non-technical References: <396F8267.B7DBCAE8@YEOW_desertigloo.com> Subject: Re: Looking for web-friendly color selector comp Date: Sat, 15 Jul 2000 00:02:15 +0200 Lines: 28 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 NNTP-Posting-Host: 195.14.226.50 Message-ID: <396f8b30@dnews> X-Trace: 14 Jul 2000 14:50:40 -0800, 195.14.226.50 Path: bornews.borland.com!dnews!195.14.226.50 "David P. Schwartz" wrote in news:396F8267.B7DBCAE8@YEOW_desertigloo.com... > I've got several color combos and color dialogs (working in D4 here), but none > of them have settings to allow them to select only "web friendly" colors. Is > there a simple way to convert the color values to HTML color specs (eg., in the > tags)? Or are there any components that support > the selection of only web-friendly colors? Maybe not the best solution, but readeable: function ColorToHTMLColor(Color: TColor): string; var RGBColor: LongInt; begin RGBColor:=ColorToRGB(Color); Result := format('#%6.6x',[((RGBColor and $FF0000) shr 16) + ((RGBColor and $00FF00)) + ((RGBColor and $0000FF) shl 16)]); end; Ralf