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
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to