Search code examples
delphifiremonkeyvcldelphi-xe6

How to have an unified color handling to be used on VCL and FMX?


I know this should be simple, but I am not getting.

I have a software that have a shared source code between FMX an VCL.

There are some places now that I need to reference colors. And this reference needs to automatically translated to the proper platform. This shared code is stored in a package that is not scoped.

I am getting part of the idea from the Platform services to implement the platform side part.

But I dont know what to use that can be the same for both platforms. Should i create may own TColor? and each platform specific implementation translate from that to the platform one?


Solution

  • Colors work differently in VCL and FMX, so you are likely going to have to implement some kind of custom abstraction layer between them for your shared code to use.