Combine two colors lazarus / 39-Graphics ---------------------------------------------------------------------- bigeno · 2018-12-01 16:55 I've some selection on spreadsheet and some cell colors. How to combine selection color with colored cells ? example below. I simply using canvas.brush.color for cell background. ---------------------------------------------------------------------- wp · 2018-12-01 18:08 Is this an fpspreadsheet question? The screenshot looks like that. In fpspreadsheet the color of the selected cells is determined by this function from the color c of the cell: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function CalcSelectionColor(c: TColor; ADelta: Byte) : TColor;type  TRGBA = record R,G,B,A: Byte end;begin  c := ColorToRGB(c);  TRGBA(Result).A := 0;  if TRGBA(c).R < 128    then TRGBA(Result).R := TRGBA(c).R + ADelta    else TRGBA(Result).R := TRGBA(c).R - ADelta;  if TRGBA(c).G < 128    then TRGBA(Result).G := TRGBA(c).G + ADelta    else TRGBA(Result).G := TRGBA(c).G - ADelta;  if TRGBA(c).B < 128    then TRGBA(Result).B := TRGBA(c).B + ADelta    else TRGBA(Result).B := TRGBA(c).B - ADelta;end;This function adds ADelta to each dark color component (i.e. makes it brigher) and subtracts ADelta from a bright color component (i.e. makes it darker). ADelta should not be too large, definitely less than 128; in the worksheet grid the value is 16. ---------------------------------------------------------------------- bigeno · 2018-12-01 19:46 No, thats screenshot from MS Excel, I work with TStringGrid. Thank you, you right, I don't need mix two colors, darker will be ok in that case ---------------------------------------------------------------------- Blaazen · 2018-12-01 20:13 I use this in ECControls: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function GetMergedColor(AColor, BColor: TColor; AProportion: Single): TColor;var aR, bR, aG, bG, aB, bB: Integer;begin  GetRGBIntValues(ColorToRGB(AColor), aR, aG, aB);  GetRGBIntValues(ColorToRGB(BColor), bR, bG, bB);  aR := bR + trunc((aR - bR)*AProportion);  aG := bG + trunc((aG - bG)*AProportion);  aB := bB + trunc((aB - bB)*AProportion);  Result := RGBToColor(aR, aG, aB);end; Parameter AProportion should be between 0..1, where 1 means AColor, 0 means BColor.