[fpc-devel] HTML string to TFPColor
    Ondrej Pokorny 
    lazarus at kluug.net
       
    Sun Jul 23 15:47:23 CEST 2017
    
    
  
On 23.07.2017 14:39, Bart wrote:
> { Try to translate HTML color code into TFPColor
>    Supports following formats
>      '#rgb'
>      '#rrggbb'
>      W3C Html color name
> }
> function TryHtmlToFPColorDef(const S: String; out FPColor: TFPColor;
> Def: TFPColor): Boolean;
Actually I wanted to use an advanced record for this (the other 
functions are from the same unit):
   TFPColor = record
     red,green,blue,alpha : word;
   public
*constructor CreateFromHTML(const HTML: string; AllowConstantNames: 
Boolean);*
     constructor Create(r,g,b,a:word);
     constructor Create(r,g,b:word);
     function AlphaBlend (color2: TFPColor): TFPColor;
     function CalculateGray : word;
   end;
Michael, is such refactoring wanted? (Of couse I'll keep the old normal 
functions as well.)
+Btw. there are much more name constants: 
https://www.w3schools.com/colors/colors_names.asp
Ondrej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20170723/eaebecc9/attachment.html>
    
    
More information about the fpc-devel
mailing list