
But stop we can’t use this method to do this task because the properties stored in FireMonkey Style is just a subset of all the properties of each object let me explain : you will check which works ok (the colors are modified as you want) and then you will write the modified Style to the TLayout.Resource property. So you will write something like this to create the TLayout objectįLayout:=TLayout(CreateObjectFromStream(nil,Stream)) Īnd now you will write a nice recursive function using the RTTI to set all the Colors of all the children objects.

So the first idea is, Hey I can load this tree of objects in a TLayout and then using the RTTI and a recursive function I can set all the properties which are of the type TAlphaColor. So the general idea is iterate over all the TAlphaColor properties, modify the colors and then write back to the TStyleBook.Resource property the modified TLayout.

The first thing that jumps out is that the root component of is a TLayout object and the style format only defines a tree of objects. In order to modify these values we need to parse the style and locate all entries which represent a TAlphaColor.

The FireMonkey styles can be embedded in the resource property of a TStyleBook component or in a. Now look the next piece of a FireMonkey style and pays attention to the highlighted valuesĪs you can see the colors of the FireMonkey style elements are stored in a hexadecimal format or using the name of the predefined FireMonkey colors, and these are the values we need to modify. Introductionįortunately the format of the styles used by FireMonkey is stored in a human readable format very similar to our old dfm format (Delphi forms), this allows us to understand how FireMonkey store, read and use these styles and of course make cool stuff with this. Maybe you’ve seen articles about how use the FireMonkey Styles, and how you can set almost every aspect of a visual control, today I will go a step forward to show how you can adjust the HSL (Hue, Saturation, and Lightness) values or a particular RGB component of the colors that belongs to a FireMonkey style.
