For ease of use, I've also declared a color like this :
or without the "%" for rgb 0-255 values
If I'm not mistaken, the GEGL color methods are linear, which makes things a bit un-intuitive.
I'm surprised
doesn't work.
Did you try it after inserting the text layer into the image ?
Code:
color = Gimp.color_parse_css("rgb(9%, 55%, 77%)")or without the "%" for rgb 0-255 values
If I'm not mistaken, the GEGL color methods are linear, which makes things a bit un-intuitive.
(11-18-2025, 02:43 PM)Volker Wrote: My environment: Apple Mac mini M2, macOS Tahoe 26.1.
I want to set the color of a text layer from a Python plug-in. In Gimp 2 I used the plug-in "gimp-text-layer-set-color".
In Gimp 3 I find the layer method "set_color(color)", but the color remains to be the foreground color. The same with the PDB plug-in.
First try with layer method:
The text is black.Code:
textColor = Gegl.Color.new("red") # e.g.
textLayer = Gimp.TextLayer.new(image, "Text", someFont, sometextSize, Gimp.Unit.pixel())
textLayer.set_name("Text")
textLayer.set_color(textColor)
image.insert_layer(textLayer, parent, position)
Next try with pdb proc:
Where is the error? With my code or with Gimp?
I'm surprised
Code:
myTextLayer.set_color(textColor)doesn't work.
Did you try it after inserting the text layer into the image ?

