2

I am trying to set Label font colors, like this:

See Image

  • TLabel1.Font.Color := clGreen;
  • TLabel2.Font.Color := clBlue;
  • TLabel3.Font.Color := clRed;

But when I choose a Custom Style:

  • Project -> Options -> Application -> Appearance -> Custom Styles
  • Enable 'TableDark' and set it as the 'Default style':

See Image

And then run the program, this is what I get:

See Image

The Label font color goes back to white (this only happen if I use one of the Custom Styles), but I really need the custom Styles ON in my program, and I also want the font colors for the Labels to remain colored and not white.

Is there any way to fix this?

Tom Brunberg
  • 20,312
  • 8
  • 37
  • 54
  • Is this with VCL or FMX? If VCL, have you tried removing the `seFont` bit from the `TLabel.StyleElements` property? If FMX, have you tried using `TLabel.FontColor` instead of `TLabel.Font.Color`, or removing the `FontColor` bit from the `TLabel.StyledSettings` property? – Remy Lebeau Feb 23 '21 at 01:50

1 Answers1

5

The Vcl Styles determine the properties (like e.g. color) of a labels text. This can, however, be overruled by

  • removing seFont from the labels StyleElements

  • changing Font properties as needed

In code you can e.g. write

  Label4.StyleElements := Label4.StyleElements - [seFont];
  Label4.Font.Color := clRed;
Tom Brunberg
  • 20,312
  • 8
  • 37
  • 54