#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "libsx.h"

static void color_exec(Widget w, CSelData *cdata)
{
char cmd[256];
  sprintf(cmd, "xsetroot -solid \\#%02X%02X%02X ", 
          (int)(cdata->r+0.5), (int)(cdata->g+0.5), (int)(cdata->b+0.5));
  system(cmd);
}

int main(int argc, char **argv)
{
  char *args[] = { "-bg" , "gray76", NULL };
  char label[80];
  char *ptr;

  PredefArgs = args;
  argc = OpenDisplay(argc, argv);
  if (argc == FALSE)
    return argc;

  GetStandardColors();
  INPUTBG = WHITE;
  BUTTONBG = GetNamedColor("Gray84");

#ifndef Xaw
  SetScrollbarDirection(-1);
#endif

  ptr = getenv("LANG");
  if (!strncmp(ptr, "de", 2)) 
     strcpy(label, "Grund Farbe");
  else
  if (!strncmp(ptr, "fr", 2)) 
     strcpy(label, "Couleur fond d'écran");
  else
     strcpy(label, "Background color");
  SelectColor("40,80,120", 0, label, color_exec, NULL);

 
  return(0);
}
