norgepaul / TChromeTabs

Comprehensive Delphi implementation of Chrome's tab system
Other
215 stars 78 forks source link

Missing ColorToRGB calls in function ColorBetween in ChromeTabsUtils #88

Closed jprse closed 3 years ago

jprse commented 3 years ago

ColorBetween is working with TColor values, assuming they are RGB values when, in fact, they might be SysColor values. Calls to ColorToRGB needs to be added. My local change is:

function ColorBetween(const ColorA, ColorB: TColor; const Percent: Integer): TColor;
var
  R1, G1, B1: Byte;
  R2, G2, B2: Byte;
  LColorA,LColorB:TColor;
begin
  LColorA := ColorToRGB(ColorA);
  LColorB := ColorToRGB(ColorB);
  R1 := GetRValue(LColorA);
  G1 := GetGValue(LColorA);
  B1 := GetBValue(LColorA);
  R2 := GetRValue(LColorB);
  G2 := GetGValue(LColorB);
  B2 := GetBValue(LColorB);
  Result := RGB(Percent * (R2 - R1) div 100 + R1, Percent * (G2 - G1) div 100 + G1,
      Percent * (B2 - B1) div 100 + B1);
end;
landrix commented 3 years ago

fixed