Die Schemalösung ist bei Verwendung von mehr als 15 Farben sehr langsam. Daher habe ich dieses Python-Skript erstellt, um eine Liste mit mehr als 20 Farben zu durchlaufen, und es ist viel schneller.
#!/usr/bin/env python
# this plug-in would normally be installed in the GIMP 2\lib\gimp\2.0\plug-ins folder
# you may need to restart GIMP for this plug-in to appear in the Colors menu
# this has been tested on Windows with Gimp 2.8.14
from gimpfu import *
def color_cycle() :
#this code sends a message back to Gimp communicating status
pdb.gimp_message('Attempting to set the foreground color...')
#you can change the colors in this list to suit your needs, but every color should be unique
colors = [(0, 0, 0),
(236, 236, 236),
(110, 110, 110),
(87, 87, 87),
(41, 28, 19),
(255, 255, 35),
(216, 216, 1),
(1, 216, 6),
(0, 119, 3),
(0, 44, 1),
(86, 160, 211),
(2, 41, 255),
(1, 22, 142),
(0, 13, 81),
(38, 0, 58),
(125, 1, 188),
(255, 192, 203),
(255, 129, 213),
(223, 1, 41),
(134, 1, 25),
(42, 0, 8),
(224, 97, 2)
]
#backup the background color
bg = gimp.get_background()
i = 0
bFound = False
while (bFound == False):
#using background to compare helps with floating point precision problems
gimp.set_background(colors[i])
if (gimp.get_foreground() == gimp.get_background()):
bFound = True
i += 1
else:
i += 1
if (i > (len(colors) - 1)):
i = 0
bFound = True
if i > len(colors) - 1:
i = 0
#if current color found in colors, then return the next one, otherwise return the first one
color = colors[i]
gimp.set_foreground(color)
#restore the backed-up background color
gimp.set_background(bg)
pdb.gimp_message('Done setting the foreground color...')
register(
"python_fu_color_cycle_fg",
"Color Cycling",
"Cycle the foreground through a list of colors.",
"David Zahn",
"David Zahn",
"2015",
"Color Cycle ForeGround",
"*", # Alternately use RGB, RGB*, GRAY*, INDEXED etc.
[
],
[],
color_cycle, menu="<Image>/Colors")
main()