[Lazarus] The color of special characters in the Source Editor
Graeme Geldenhuys
graemeg.lists at gmail.com
Thu Sep 15 15:32:15 CEST 2011
On 15/09/2011 14:50, Martin wrote:
>> If I understand this right, it would make comment background color stop working?
>>
> good point
Umm... then what if the special characters is always rendered using the
same foreground color as setup for Comments - just a bit darker or light
than the original color.
Attached are a few screenshots and a demo program showing what I mean.
Note the "dots" (spaces) inside Comments are darker or lighter shade of
the original color. The normal Spaces foreground color is a completely
separate color.
>From the demo program, here is the code I used to calculate the Dark and
Light color based on the Original color value.
----8<-------------8<-------------8<-------------8<-------------8<----
function Dark(Col: TfpgColor; Percent: Byte): TfpgColor;
var
lColor: TFPColor;
begin
lColor.Red := fpgGetRed(Col);
lColor.Green := fpgGetGreen(Col);
lColor.Blue := fpgGetBlue(Col);
lColor.Red := Round(lColor.Red*Percent/100);
lColor.Green := Round(lColor.Green*Percent/100);
lColor.Blue := Round(lColor.Blue*Percent/100);
Result := FPColorTofpgColor(lColor);
end;
function Light(Col: TfpgColor; Percent: Byte): TfpgColor;
var
lColor: TFPColor;
begin
lColor.Red := fpgGetRed(Col);
lColor.Green := fpgGetGreen(Col);
lColor.Blue := fpgGetBlue(Col);
lColor.Red := Round(lColor.Red*Percent/100) + Round(255 -
Percent/100*255);
lColor.Green := Round(lColor.Green*Percent/100) + Round(255 -
Percent/100*255);
lColor.Blue := Round(lColor.Blue*Percent/100) + Round(255 -
Percent/100*255);
Result := FPColorTofpgColor(lColor);
end;
----8<-------------8<-------------8<-------------8<-------------8<----
Regards,
- Graeme -
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot-MainForm.png
Type: image/png
Size: 3790 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110915/0ae6dc8c/attachment-0009.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: code1.png
Type: image/png
Size: 4099 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110915/0ae6dc8c/attachment-0010.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: code2.png
Type: image/png
Size: 3126 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110915/0ae6dc8c/attachment-0011.png>
More information about the Lazarus
mailing list