Jump to content

Farbauswahl in Add-on Settings? / Colour selection in add-on settings?


Recommended Posts

Hallo allerseits,

gibt es die Möglichkeit, in "metainfo.json" eine Farbauswahl zu programmieren, so dass diese in den entsprechenden Add-on Settings in den Voreinstellungen angezeigt wird? In der Dokumentation zu den Add-on Settings ist dazu leider nichts enthalten.

Vielen Dank im voraus für eine Info dazu!

-------------------------------------------

Hello everyone,

Is it possible to program a colour selection in "metainfo.json" so that it is displayed in the corresponding add-on settings in the default settings? Unfortunately, there is nothing in the documentation for the add-on settings.

Many thanks in advance for any information on this!

-------------------------------------------

image.png.3acc9bc6d93b70437abf83cc4a36729f.png

Hello Mr. Gallasch,

'file' is currently the only non-basic type provided. I suggest to store the color settings as a string containing either the hex value or the color name.

  • If you want to use the color in the context of an HTML element, you can use the color string directly if you adhere to the HTML color syntax.
  • If you need a gom.Color object, you can convert a color name to RGBA values (or vice versa) using the Python package 'webcolors'.

To convert between RGBA values and gom.Color object:

color = gom.color(r, g, b, a)
r = color.r
g = color.g
b = color.b
a = color.a

Hope this helps!

Best regards,

Matthias Prinke

 

×
×
  • Create New...