我试图将这些常量中的颜色传递给下面的 Set fontcolor 函数,但每次我这样做时都会得到“无法解析颜色名称”,除非我直接从 GIMP 对话框传递它。我什至记录了直接传入的变量,数字 2 中的值是日志的直接副本。谁能看到我做错了什么或错过了什么。谢谢
FontGREEN1 = '(RGB(0,255,0,))'
FontGREEN2 = 'RGB (0.0, 1.0, 0.0, 1.0)'
#This causes the error
def setColor1 ( txtlayer, color):
color = FontGREEN1
pdb.gimp_text_layer_set_color(txtlayer, color)
#This causes the error
def setColor2 ( txtlayer ):
color = FontGREEN2
pdb.gimp_text_layer_set_color(txtlayer, color)
#this work fine, color passed directly from GIMP Dialog
def setColor3 ( txtlayer, color):
pdb.gimp_text_layer_set_color(txtlayer, color)
def setTextColor (img, drw, color ):
txtlayer = img.active_layer
setColor3(txtlayer, color)
register(
'setTextColor',
'Changes the color of the text with python',
'Changes the color of the text with python',
'RS',
'(cc)',
'2014',
'<Image>/File/Change Text Color...',
'', # imagetypes
[
(PF_COLOR,"normal_color","Green Color of the Normal Font",(0,234,0) ),
], # Parameters
[], # Results
setTextColor)
main()