Search code examples
delphidelphi-11-alexandria

See webcolors and custom colors in Delphi's Object Inspector colorpicker at design-time


when designing a form and its components at design-time, some properties of color type allow us to choose colors from a list of predefined default Delphi colors:

enter image description here

double clicking on this property, we can even see a color-picker which lists some additional options and offers the ability to define custom colors.

However, I would like to define a custom palette for my application; that is, to add some of the named clWeb colors to the dropdown list (screenshotted above), maybe even colors that I can name myself.

In short, I would like to make a consistent set of web-colors of my choice to always appear in the dropdown color list when picking colors at design-time in the IDE, so I can color my components in a modern, yet coherent manner.

Themes, while very uniform, are too rigid and introduce weird glitches in places.

Any suggestions?

Delphi 11.3


Solution

  • I'm not aware about any "ready to use" solution. Anyhow, you could try to create your own property editor and register it in the IDE as the editor for the TColor type.

    It could be a little bit complex, but it basically consists in two parts as mentioned before:

    1. Creating the property editor (it should be a TPropertyEditor descendant class)

    2. Registering your property editor as as the editor for the TColor type (you will need to use the RegisterPropertyEditor procedure)

    I also suggest you to read these pages: