diff -upNr gimptmp/app/actions/context-actions.c gimp/app/actions/context-actions.c
--- gimptmp/app/actions/context-actions.c	2006-02-27 11:09:40.597062352 +1030
+++ gimp/app/actions/context-actions.c	2006-02-26 14:13:22.000000000 +1030
@@ -69,7 +69,44 @@ static GimpActionEntry context_actions[]
   { "context-colors-swap", GIMP_STOCK_SWAP_COLORS,
     N_("S_wap Colors"), "X", NULL,
     G_CALLBACK (context_colors_swap_cmd_callback),
-    GIMP_HELP_TOOLBOX_SWAP_COLORS }
+    GIMP_HELP_TOOLBOX_SWAP_COLORS },
+
+  /* XXX give this its own group */
+
+
+  { "context-foreground-next-in-palette", GIMP_STOCK_SWAP_COLORS,
+    N_("Set Foreground from next palette color"), NULL, NULL,
+    G_CALLBACK (context_foreground_next_in_pal_cmd_callback),
+    GIMP_HELP_TOOLBOX_SWAP_COLORS },
+
+  { "context-foreground-prev-in-palette", GIMP_STOCK_SWAP_COLORS,
+    N_("Set Foreground from previous palette color"), NULL, NULL,
+    G_CALLBACK (context_foreground_previous_in_pal_cmd_callback),
+    GIMP_HELP_TOOLBOX_SWAP_COLORS },
+
+  { "context-foreground-next-in-palette-skip", GIMP_STOCK_SWAP_COLORS,
+    N_("Set Foreground from (current + N) palette color"), NULL, NULL,
+    G_CALLBACK (context_foreground_next_in_pal_skip_cmd_callback),
+    GIMP_HELP_TOOLBOX_SWAP_COLORS },
+
+  { "context-foreground-prev-in-palette-skip", GIMP_STOCK_SWAP_COLORS,
+    N_("Set Foreground from (current - N) palette color"), NULL, NULL,
+    G_CALLBACK (context_foreground_previous_in_pal_skip_cmd_callback),
+    GIMP_HELP_TOOLBOX_SWAP_COLORS },
+
+  /* XXX ambiguity */
+
+  { "context-foreground-first-in-palette", GIMP_STOCK_SWAP_COLORS,
+    N_("Set Foreground from minimum palette color"), NULL, NULL,
+    G_CALLBACK (context_foreground_first_in_pal_cmd_callback),
+    GIMP_HELP_TOOLBOX_SWAP_COLORS },
+
+  { "context-foreground-last-in-palette", GIMP_STOCK_SWAP_COLORS,
+    N_("Set Foreground from maximum palette color"), NULL, NULL,
+    G_CALLBACK (context_foreground_last_in_pal_cmd_callback),
+    GIMP_HELP_TOOLBOX_SWAP_COLORS },
+
+
 };
 
 static GimpEnumActionEntry context_foreground_red_actions[] =
diff -upNr gimptmp/app/actions/context-commands.c gimp/app/actions/context-commands.c
--- gimptmp/app/actions/context-commands.c	2006-02-27 11:10:25.461241960 +1030
+++ gimp/app/actions/context-commands.c	2006-02-26 16:49:25.000000000 +1030
@@ -33,10 +33,10 @@
 #include "core/gimpdatafactory.h"
 #include "core/gimplist.h"
 
+
 #include "actions.h"
 #include "context-commands.h"
 
-
 static const GimpLayerModeEffects paint_modes[] =
 {
   GIMP_NORMAL_MODE,
@@ -71,6 +71,8 @@ static void   context_select_object    (
                                         GimpContainer        *container);
 static gint   context_paint_mode_index (GimpLayerModeEffects  paint_mode);
 
+static GimpPaletteEditor   *context_get_palette_editor();
+
 
 /*  public functions  */
 
@@ -608,3 +610,100 @@ context_paint_mode_index (GimpLayerModeE
 
   return i;
 }
+
+
+/* XXX make this into a separate compile */
+ 
+#include "context-commands-palette.ch"
+
+#define MAXENTRY 16777216
+
+/* preprocessor simplifications for things I couldn't factor out */
+
+#define MATCH() context_match_color(&color)
+
+#define INITFG()	    \
+  GimpRGB            color; \
+  GimpContext       *context; \
+ \
+  return_if_no_context(context, data); \
+  gimp_context_get_foreground(context, &color)
+
+#define ENDFG() gimp_context_set_foreground(context, &color)
+#define INITBG()	    \
+  GimpRGB            color; \
+  GimpContext       *context; \
+ \
+  return_if_no_context(context, data); \
+  gimp_context_get_background(context, &color)
+
+#define ENDBG() gimp_context_set_background(context, &color)
+
+void
+context_foreground_next_in_pal_cmd_callback( GtkAction *action,
+                                             gpointer   data)
+{
+  INITFG();
+  MATCH();  
+  context_get_next_in_palette(&color);
+  ENDFG();
+
+}
+
+void
+context_foreground_next_in_pal_skip_cmd_callback( GtkAction *action,
+                                                  gpointer   data)
+{
+  INITFG();
+  MATCH();  
+  context_skip_in_palette(SKIPSTEP, &color);
+  ENDFG();
+
+}
+
+void
+context_foreground_first_in_pal_cmd_callback( GtkAction *action,
+                                             gpointer   data)
+{
+
+  GimpRGB            color;
+  GimpContext       *context;
+
+  return_if_no_context(context, data);
+  context_color_from_palette_index(0, &color);
+  ENDFG();
+
+}
+
+void
+context_foreground_last_in_pal_cmd_callback( GtkAction *action,
+                                             gpointer   data)
+{
+  INITFG();
+  context_color_from_palette_index(MAXENTRY, &color);
+  ENDFG();
+}
+
+
+void
+context_foreground_previous_in_pal_cmd_callback( GtkAction *action,
+                                                 gpointer   data)
+{
+  INITFG();
+  MATCH();
+  context_get_previous_in_palette(&color);
+  ENDFG();
+}
+
+
+void
+context_foreground_previous_in_pal_skip_cmd_callback( GtkAction *action,
+                                                      gpointer   data)
+{
+  INITFG();
+  MATCH();
+  context_skip_in_palette(-SKIPSTEP, &color);
+  ENDFG();
+}
+
+/* background changers go here */
diff -upNr gimptmp/app/actions/context-commands.h gimp/app/actions/context-commands.h
--- gimptmp/app/actions/context-commands.h	2006-02-27 11:10:25.462241808 +1030
+++ gimp/app/actions/context-commands.h	2006-02-26 12:17:15.000000000 +1030
@@ -110,5 +110,24 @@ void   context_brush_angle_cmd_callback 
                                              gint       value,
                                              gpointer   data);
 
+void   context_foreground_next_in_pal_cmd_callback  (GtkAction   *action,
+                                                     gpointer     data);
+
+void   context_foreground_next_in_pal_skip_cmd_callback  (GtkAction   *action,
+							  gpointer     data);
+
+
+void   context_foreground_previous_in_pal_cmd_callback  (GtkAction   *action,
+                                                         gpointer     data);
+
+void   context_foreground_previous_in_pal_skip_cmd_callback  (GtkAction   *action,
+                                                         gpointer     data);
+
+void   context_foreground_first_in_pal_cmd_callback     (GtkAction   *action,
+                                                         gpointer     data);
+
+void   context_foreground_last_in_pal_cmd_callback      (GtkAction   *action,
+                                                         gpointer     data);
+
 
 #endif /* __CONTEXT_COMMANDS_H__ */
diff -upNr gimptmp/app/actions/context-commands-palette.ch gimp/app/actions/context-commands-palette.ch
--- gimptmp/app/actions/context-commands-palette.ch	1970-01-01 09:30:00.000000000 +0930
+++ gimp/app/actions/context-commands-palette.ch	2006-02-26 16:01:22.000000000 +1030
@@ -0,0 +1,272 @@
+/* this is a temporary location
+   for a file that is currently #included 
+   which eventually will be compiled separately.
+ */
+
+/* XXX colorchange.c stuff */
+
+#include "core/gimpimage.h"
+#include "core/gimpimage-colormap.h"
+#include "widgets/gimppaletteeditor.h"
+#include "widgets/gimpdialogfactory.h"
+#include "widgets/gimpcolormapeditor.h"
+#include "widgets/gimppaletteeditor.h"
+#include "widgets/gimpsessioninfo.h"
+
+/* ends here */
+
+/* XXX hack */
+
+#define HAVE_COLORMAP(gimage) \
+        (gimage != NULL && \
+         gimp_image_base_type (gimage) == GIMP_INDEXED && \
+         gimp_image_get_colormap (gimage) != NULL)
+
+
+/* everything is inlined, for maximum speed on low end computers */
+
+inline GimpPaletteEditor *
+context_get_palette_editor()
+{
+  GimpDialogFactory *dialog_factory;
+  GimpSessionInfo   *info;
+  GtkWidget         *palette_editor = NULL;
+  dialog_factory = gimp_dialog_factory_from_name ("dock");
+  g_return_val_if_fail(dialog_factory != NULL, NULL);
+  info = gimp_dialog_factory_find_session_info (dialog_factory,
+                                                "gimp-palette-editor");
+  g_return_val_if_fail(info != NULL, NULL);
+  if (info && info->widget)
+    palette_editor = gtk_bin_get_child (GTK_BIN (info->widget));
+
+  g_return_val_if_fail(palette_editor != NULL, NULL);
+  return GIMP_PALETTE_EDITOR(palette_editor);
+
+}
+
+inline GimpColormapEditor *
+context_get_colormap_editor()
+{
+ GimpDialogFactory *dialog_factory;
+  GimpSessionInfo   *info;
+  GtkWidget         *colormap_editor = NULL;
+  dialog_factory = gimp_dialog_factory_from_name ("dock");
+  g_return_val_if_fail(dialog_factory != NULL, NULL);
+  info = gimp_dialog_factory_find_session_info (dialog_factory,
+                                                "gimp-indexed-palette");
+  g_return_val_if_fail(info != NULL, NULL);
+  if (info && info->widget)
+    colormap_editor = gtk_bin_get_child (GTK_BIN (info->widget));
+
+  g_return_val_if_fail(colormap_editor != NULL, NULL);
+  return GIMP_COLORMAP_EDITOR(colormap_editor);
+
+}
+
+
+inline void
+context_get_current_in_palette(GimpRGB *color)
+{
+  GimpPaletteEditor  *peditor;
+  GimpColormapEditor *ceditor;
+
+  ceditor = context_get_colormap_editor();
+  if (ceditor)
+    {
+      if (HAVE_COLORMAP( GIMP_IMAGE_EDITOR(ceditor)->gimage))
+	{
+	  gimp_colormap_editor_current_color( ceditor, color);
+	  return;
+	}
+    }
+  
+  peditor = context_get_palette_editor();
+  g_return_if_fail(peditor != NULL);
+  gimp_palette_editor_current_color( peditor, color);
+  
+}
+
+
+inline void
+context_get_next_in_palette(GimpRGB *color)
+{
+  GimpPaletteEditor  *peditor;
+  GimpColormapEditor *ceditor;
+
+  ceditor = context_get_colormap_editor();
+  if (ceditor)
+    {
+      if (HAVE_COLORMAP( GIMP_IMAGE_EDITOR(ceditor)->gimage))
+	{
+	  gimp_colormap_editor_next_color( ceditor);
+	  gimp_colormap_editor_current_color( ceditor, color);
+	  return;
+	}
+    }
+  
+  peditor = context_get_palette_editor();
+  g_return_if_fail(peditor != NULL);
+  gimp_palette_editor_next_color( peditor); 
+  gimp_palette_editor_current_color( peditor, color);
+  
+}
+
+inline void
+context_get_previous_in_palette(GimpRGB *color)
+{
+  GimpPaletteEditor  *peditor;
+  GimpColormapEditor *ceditor;
+
+  ceditor = context_get_colormap_editor();
+  if (ceditor)
+    {
+      if (HAVE_COLORMAP( GIMP_IMAGE_EDITOR(ceditor)->gimage))
+	{
+	  gimp_colormap_editor_previous_color( ceditor);
+	  gimp_colormap_editor_current_color( ceditor, color);
+	  return;
+	}
+    }
+  
+  peditor = context_get_palette_editor();
+  g_return_if_fail(peditor != NULL);
+  gimp_palette_editor_previous_color( peditor); 
+  gimp_palette_editor_current_color( peditor, color);
+  
+}
+
+
+
+/* XXX change this */
+#define SKIPSTEP 4
+
+inline void
+context_skip_in_palette(gint step, GimpRGB *color)
+{
+  GimpPaletteEditor  *peditor;
+  GimpColormapEditor *ceditor;
+
+  ceditor = context_get_colormap_editor();
+  if (ceditor)
+    {
+      if (HAVE_COLORMAP( GIMP_IMAGE_EDITOR(ceditor)->gimage))
+	{
+	  gimp_colormap_editor_go( ceditor, FALSE, step);
+	  gimp_colormap_editor_current_color( ceditor, color);
+	  return;
+	}
+    }
+  
+  peditor = context_get_palette_editor();
+  g_return_if_fail(peditor != NULL);
+  gimp_palette_editor_go( peditor, FALSE, step); 
+  gimp_palette_editor_current_color( peditor, color);
+
+
+
+}
+
+inline void
+context_go_in_palette(gint index, GimpRGB *color)
+{
+  GimpPaletteEditor  *peditor;
+  GimpColormapEditor *ceditor;
+
+  ceditor = context_get_colormap_editor();
+  if (ceditor)
+    {
+      if (HAVE_COLORMAP( GIMP_IMAGE_EDITOR(ceditor)->gimage))
+	{
+	  gimp_colormap_editor_go( ceditor, TRUE, index);
+	  gimp_colormap_editor_current_color( ceditor, color);
+	  return;
+	}
+    }
+  
+  peditor = context_get_palette_editor();
+  g_return_if_fail(peditor != NULL);
+  gimp_palette_editor_go( peditor, TRUE, index);
+  gimp_palette_editor_current_color( peditor, color);
+
+
+
+}
+
+inline gint
+context_palette_color_index ( GimpRGB *color)
+{
+  GimpPaletteEditor  *peditor;
+  GimpColormapEditor *ceditor;
+
+  ceditor = context_get_colormap_editor();
+  if (ceditor)
+    {
+      if (HAVE_COLORMAP( GIMP_IMAGE_EDITOR(ceditor)->gimage))
+	{
+	  return gimp_colormap_editor_color_index( ceditor, color);
+	}
+    }
+  
+  peditor = context_get_palette_editor();
+  g_return_val_if_fail(peditor != NULL, -1);
+  return gimp_palette_editor_color_index( peditor, color); 
+
+}
+
+
+inline void
+context_color_from_palette_index ( gint index,
+           	                   GimpRGB *color)
+{
+  GimpPaletteEditor  *peditor;
+  GimpColormapEditor *ceditor;
+
+  ceditor = context_get_colormap_editor();
+  if (ceditor)
+    {
+      if (HAVE_COLORMAP( GIMP_IMAGE_EDITOR(ceditor)->gimage))
+	{
+	  gimp_colormap_editor_go( ceditor, TRUE, index);
+	  gimp_colormap_editor_current_color( ceditor, color);
+	  return;
+	}
+    }
+  
+  peditor = context_get_palette_editor();
+  g_return_if_fail(peditor != NULL);
+  gimp_palette_editor_go( peditor, TRUE, index); 
+  gimp_palette_editor_current_color( peditor, color);
+  
+}
+
+
+inline void
+context_match_color(GimpRGB *color)
+{
+  gint    index;
+  GimpRGB palcolor;
+
+  printf("in match_color\n");
+  /* Try to select the entry in the colormap editor or palette editor
+     that matches the color. */
+  
+  /* Same color as current? */
+  context_get_current_in_palette(&palcolor);
+  printf("Palette color %f %f %f VS %f %f %f", palcolor.r, palcolor.g, palcolor.b,color->r,color->g,color->b);
+  if (palcolor.r == color->r && palcolor.g == color->g &&
+      palcolor.b == color->b)
+  {
+    printf("Matched current\n");
+    return;
+  }
+
+  printf("searching for color\n");
+
+  /* Search for color */
+  index = context_palette_color_index( color);
+  if (index == -1)
+    return;
+
+  printf("success %d\n", index);
+  context_color_from_palette_index( index, color);
+}
diff -upNr gimptmp/app/core/gimppalette.c gimp/app/core/gimppalette.c
--- gimptmp/app/core/gimppalette.c	2006-02-27 11:10:26.995008792 +1030
+++ gimp/app/core/gimppalette.c	2006-02-25 19:29:24.000000000 +1030
@@ -654,6 +654,28 @@ gimp_palette_delete_entry (GimpPalette  
     }
 }
 
+gint
+gimp_palette_color_index (GimpPalette *palette,
+                          GimpRGB     *color)
+{
+  GList   *list;
+  GimpRGB *data;
+  gint     i;
+  g_return_val_if_fail (GIMP_IS_PALETTE (palette),-1);
+  list = palette->colors;
+  g_return_val_if_fail( list != NULL, -1);
+  i = 0;
+  while (list)
+    {
+      data = (GimpRGB *)&( ( (GimpPaletteEntry *)(list->data))->color);
+      if (data->r == color->r && data->g == color->g && data->b == color->b)
+	return i;
+      list = list->next;
+      i++;
+    }
+  return -1;
+}
+
 void
 gimp_palette_set_columns (GimpPalette *palette,
                           gint         columns)
diff -upNr gimptmp/app/core/gimppalette.h gimp/app/core/gimppalette.h
--- gimptmp/app/core/gimppalette.h	2006-02-27 11:10:27.007006968 +1030
+++ gimp/app/core/gimppalette.h	2006-02-25 19:30:05.000000000 +1030
@@ -76,6 +76,10 @@ GimpPaletteEntry * gimp_palette_add_entr
 void               gimp_palette_delete_entry (GimpPalette      *palette,
                                               GimpPaletteEntry *entry);
 
+gint               gimp_palette_color_index  (GimpPalette      *palette,
+                                              GimpRGB          *color);
+
+
 void               gimp_palette_set_columns  (GimpPalette      *palette,
                                               gint              columns);
 gint               gimp_palette_get_columns  (GimpPalette      *palette);
diff -upNr gimptmp/app/widgets/gimpcolormapeditor.c gimp/app/widgets/gimpcolormapeditor.c
--- gimptmp/app/widgets/gimpcolormapeditor.c	2006-02-27 11:10:28.337804656 +1030
+++ gimp/app/widgets/gimpcolormapeditor.c	2006-02-26 12:21:04.000000000 +1030
@@ -787,3 +787,85 @@ gimp_colormap_image_colormap_changed (Gi
   if (ncol == editor->col_index || ncol == -1)
     gimp_colormap_editor_update_entries (editor);
 }
+
+
+
+void
+gimp_colormap_editor_next_color(GimpColormapEditor *editor)
+{
+  gint newval;
+  g_return_if_fail(editor != NULL);
+  g_return_if_fail( HAVE_COLORMAP( GIMP_IMAGE_EDITOR (editor)->gimage));
+
+  newval = MIN (editor->col_index + 1, editor->index_adjustment->upper);
+  gimp_colormap_editor_set_index (editor, newval);  
+
+}
+
+void
+gimp_colormap_editor_previous_color(GimpColormapEditor *editor)
+{
+  gint newval;
+  g_return_if_fail(editor != NULL);
+  g_return_if_fail( HAVE_COLORMAP( GIMP_IMAGE_EDITOR (editor)->gimage));
+
+  newval = MAX (editor->col_index - 1, 0);
+  gimp_colormap_editor_set_index (editor, newval);  
+
+}
+
+void
+gimp_colormap_editor_go(GimpColormapEditor *editor,
+			gint                absolute,
+			gint                amount)
+{
+  gint newval;
+  g_return_if_fail(editor != NULL);
+  g_return_if_fail( HAVE_COLORMAP( GIMP_IMAGE_EDITOR (editor)->gimage));
+
+  newval = editor->col_index + amount;
+  if (absolute)
+    newval = amount;
+  newval = CLAMP (newval, 0, editor->index_adjustment->upper);
+  gimp_colormap_editor_set_index (editor, newval);  
+
+}
+
+
+void
+gimp_colormap_editor_current_color(GimpColormapEditor *editor,
+				   GimpRGB            *color)
+{
+  g_return_if_fail(editor != NULL);
+  g_return_if_fail( HAVE_COLORMAP(GIMP_IMAGE_EDITOR (editor)->gimage));
+  
+  {
+    guchar    *colormap = GIMP_IMAGE_EDITOR (editor)->gimage->cmap;
+    gint       i        = editor->col_index;
+
+    gimp_rgb_set_uchar(color, colormap[i * 3], colormap[i * 3 + 1], colormap[i * 3 + 2]);
+  }
+}
+
+
+gint
+gimp_colormap_editor_color_index(GimpColormapEditor *editor,
+				 GimpRGB            *color)
+{
+  guchar    *colormap;
+  guchar     r,g,b;
+  gint       i;
+
+  g_return_val_if_fail( HAVE_COLORMAP(GIMP_IMAGE_EDITOR (editor)->gimage), -1);
+
+  colormap = GIMP_IMAGE_EDITOR (editor)->gimage->cmap;
+  gimp_rgb_get_uchar(color, &r,&g,&b);
+
+  for (i = 0; i <= editor->index_adjustment->upper; i++)
+    {
+      if (colormap[i * 3] == r && colormap[i * 3 + 1] == g && colormap[i * 3 + 2] == b)
+	return i;
+    }
+  return -1;
+
+}
diff -upNr gimptmp/app/widgets/gimpcolormapeditor.h gimp/app/widgets/gimpcolormapeditor.h
--- gimptmp/app/widgets/gimpcolormapeditor.h	2006-02-27 11:10:28.339804352 +1030
+++ gimp/app/widgets/gimpcolormapeditor.h	2006-02-26 12:21:40.000000000 +1030
@@ -71,5 +71,17 @@ void        gimp_colormap_editor_selecte
                                             GdkModifierType     state);
 gint        gimp_colormap_editor_col_index (GimpColormapEditor *editor);
 
+void        gimp_colormap_editor_next_color    (GimpColormapEditor *editor);
+void        gimp_colormap_editor_previous_color(GimpColormapEditor *editor);
+void        gimp_colormap_editor_go            (GimpColormapEditor *editor,
+						gint absolute,
+						gint amount);
+
+void        gimp_colormap_editor_current_color(GimpColormapEditor *editor,
+					       GimpRGB *color);
+
+gint        gimp_colormap_editor_color_index  (GimpColormapEditor *editor,
+					       GimpRGB *color);
+
 
 #endif /* __GIMP_COLORMAP_EDITOR_H__ */
diff -upNr gimptmp/app/widgets/gimppaletteeditor.c gimp/app/widgets/gimppaletteeditor.c
--- gimptmp/app/widgets/gimppaletteeditor.c	2006-02-27 11:10:29.444636392 +1030
+++ gimp/app/widgets/gimppaletteeditor.c	2006-02-26 16:21:40.000000000 +1030
@@ -808,3 +808,121 @@ palette_editor_scroll_top_left (GimpPale
   if (vadj)
     gtk_adjustment_set_value (vadj, 0.0);
 }
+
+
+void
+gimp_palette_editor_next_color (GimpPaletteEditor *editor)
+{
+  GList *tmp;
+  GimpPalette *palette;
+
+  palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
+  
+  tmp = g_list_find(palette->colors, editor->color);
+
+  if (tmp == NULL)
+    return;
+
+  g_return_if_fail(editor->view != NULL);
+ 
+  if (tmp->next)
+    gimp_palette_view_select_entry( GIMP_PALETTE_VIEW(editor->view),
+                                   (GimpPaletteEntry *)(tmp->next->data));  
+}
+
+
+void
+gimp_palette_editor_previous_color (GimpPaletteEditor *editor)
+{
+  GList       *tmp;
+  GimpPalette *palette;
+
+  palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
+  tmp = g_list_find(palette->colors, editor->color);
+  
+  g_return_if_fail(editor->view != NULL);
+  
+  if (tmp->prev)
+    gimp_palette_view_select_entry( GIMP_PALETTE_VIEW(editor->view),
+                                   (GimpPaletteEntry *)(tmp->prev->data));
+
+}
+
+void 
+gimp_palette_editor_go( GimpPaletteEditor *editor,
+                        gint               absolute,
+                        gint               amount)
+{
+  GimpPalette *palette;
+  GList       *list;
+  gint         index;
+
+  palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
+  g_return_if_fail(palette != NULL);
+
+
+  if (absolute)
+    index = amount;
+  else
+    { 
+      index = g_list_index(palette->colors, editor->color);
+      if (index == -1)
+	index = 0;
+      index += amount;
+    }
+
+  /* for some reason CLAMP doesn't work here -- it wraps -1 to 255 (palette len == 256)
+   */
+  if (index < 0)
+    index = 0;
+  else 
+    {
+      gint maxi = g_list_length(palette->colors) - 1;
+      if (index >= maxi)
+        index = maxi;
+    }
+
+  list = g_list_nth(palette->colors, index);
+
+  if (list)
+      gimp_palette_view_select_entry( GIMP_PALETTE_VIEW(editor->view),
+                                   (GimpPaletteEntry *)(list->data));
+}
+
+void
+gimp_palette_editor_current_color( GimpPaletteEditor *editor,
+                                   GimpRGB           *color)
+{
+  GimpRGB *tmp;
+  g_return_if_fail(editor != NULL);
+  if (editor->color == NULL)
+    return;
+  tmp = &(editor->color->color);
+  color->r = tmp->r;
+  color->g = tmp->g;
+  color->b = tmp->b;
+}
+
+gint
+gimp_palette_editor_color_index(GimpPaletteEditor *editor,
+				GimpRGB           *color)
+{
+  GimpPalette *palette;
+  gint         i;
+  GimpRGB     *palcolor;
+  GList       *list;
+  palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
+  list = palette->colors;
+  i = 0;
+  while (list)
+    {
+      palcolor = &( ( (GimpPaletteEntry *)(list->data))->color );
+      if (palcolor->r == color->r && palcolor->g == color->g && palcolor->b == color->b)
+	return i;
+
+      list = list->next;
+      i++;
+    }
+
+  return -1;
+}
diff -upNr gimptmp/app/widgets/gimppaletteeditor.h gimp/app/widgets/gimppaletteeditor.h
--- gimptmp/app/widgets/gimppaletteeditor.h	2006-02-27 11:10:29.446636088 +1030
+++ gimp/app/widgets/gimppaletteeditor.h	2006-02-26 03:08:14.000000000 +1030
@@ -70,5 +70,16 @@ void        gimp_palette_editor_pick_col
 void        gimp_palette_editor_zoom       (GimpPaletteEditor  *editor,
                                             GimpZoomType        zoom_type);
 
+void        gimp_palette_editor_next_color        (GimpPaletteEditor  *editor);
+void        gimp_palette_editor_previous_color    (GimpPaletteEditor  *editor);
+void        gimp_palette_editor_go                (GimpPaletteEditor *editor,
+                                                   gint               absolute,
+                                                   gint               amount);
+
+gint        gimp_palette_editor_color_index       (GimpPaletteEditor  *editor, 
+                                                   GimpRGB *color);
+
+void        gimp_palette_editor_current_color     (GimpPaletteEditor  *editor,
+                                                   GimpRGB *color);
 
 #endif /* __GIMP_PALETTE_EDITOR_H__ */
