Graphics::ColorPicker - Graphics::ColorPicker documentation


Graphics-ColorPicker documentation  | view source Contained in the Graphics-ColorPicker distribution.

Index


NAME

Top

  Graphics::ColorPicker : A perl module for WYSIWYG web 
  applications that allow selection of HEX color numbers

SYNOPSIS

Top

  use Graphics::ColorPicker;
    or
  require  Graphics::ColorPicker;

  make_page($path_to_images);
  send_page(\$html_txt,$type);
  $time_string = http_date($time);
  $name = script_name;
  $html_text=frames($websafe);
  $html_text = msie_frame;
  $html_text=picker($darkimg,$liteimg,$size,$bsize,greyimg);
  $html_text=no_picker;
  $html_text=cp216_ds($clrdot,$border,$square)
  $javascript_text = jslib;
  $html=make_buttons(\%look_n_feel,$url,$active,\@buttons,$xtra);
  $html_text=pluck($color);
  $html_text=hex_update($hex_color);

SAMPLE WEBSITE - 24 million color picker

Top

http://www.bizsystems.net/downloads/graphics/demo.html

DESCRIPTION

Top

This module generates a set of palettes to select a HEX or DECIMAL color number via a web browser. make_page() can be called by javascript from your web page and will set the HEX value in a variable in the calling page and scope. The selector page can be created for 24 million or web safe colors only.

  <script language=javascript1.1>
  var colorhex = '';
  var w;
  function pop() {
    if (document.forms.color.what.checked){w=180;}else{w=630;}
    var colorwin = open("","colorpicker",
    "width=" + w + ",height=440,status=no,directories=no," +
    "location=no,menubar=no,scrollbars=no,toolbar=no");
    if (colorwin.opener == null) newin.opener = self;  
    colorwin.document.close();
    colorwin.focus();
    return true;
  }
  </script>
  <body>
  <form name="color" onSubmit="return(pop());"
   action="p_gen.cgi" target="colorpicker">   
  <input type=text name=hex size=10><br>
  <input type=checkbox name=what value=wo> web safe colors only<br>
  <input type=submit value="Pop Picker Window">
  </form>

  See B<examples/demo.html> and B<scripts/p_gen.cgi>
  Read INSTALL

make_page($path_to_images);
  Generate Color Picker Pages

  This is the only routine that really needs to be called
  externally. You could roll your own from the following
  calls for a special purpose, but it's really not necessary.

  i.e. Graphics::ColorPicker::make_page('./');

  will generate the picker pages as required

$time_string = http_date($time);
  Returns time string in HTTP date format, same as...

  Apache::Util::ht_time(time, "%a, %d %b %Y %T %Z",1));

  i.e. Sat, 13 Apr 2002 17:36:42 GMT

$name = script_name;
  Returns the subroutine name of the calling 
  script external to this library

$html_text=frames($websafe);
  Returns the frame text for top window.

  input:  true = 24 million colors
	  false = web safe colors only

  return:  html text for page

$html_text = msie_frame;
  Return the text for the copyright notice
  (sample frame) for browsers that can't do
  "javascript:xxx()" from within a frame 
  like brain dead MSIE browsers.

$html_text=picker($darkimg,$liteimg,$size,$bsize,greyimg);
  Return frame text for color picker

  input:   $darkimg, # path to dark image
	   $liteimg, # path to light image
	   $size,    # pixel size of image
	   $bsize,   # button pixel size
	   $greyimg  # path to grey image

  returns: html text

$html_text=no_picker;
  Returns minimum contents for a blank 24 million
  color page when only "Web Only" colors are called

$html_text=cp216_ds($clrdot,$border,$square)
  Returns 216 color & digits page

  input:   clrdot, # path to clear dot image
	   border, # border of color square
	   square, # square size

  returns: html text

$javascript_text = jslib;
  Return contents of javascript library

  input: none

$html=make_buttons(\%look_n_feel,$url,$active,\@buttons,$xtra);
  Called internally

  Return the html text for a button bar

  input:  button_color, width, \@buttons

  @buttons is a list of the form = (
        # text        command 
        'BUTT1' => 'command1',
        'BUTT2' => 'command2',
        ''      => '',		# empty
  );
        If the button text is false,
        a spacer is inserted in the button bar

  returns:      html for button bar




  NOTE:         class NU must be defined
  example:
                <style>
                A.NU { 
                  color: red; // #ff0000
                  background: transparent;
                  font-family: VERDANA,ARIAL,HELVETICA,SAN-SERIF;
		  font-size:  12px !important;
                  font-weight: bold;
                  text-decoration: none;
                }
                </style>

$html_text=pluck($color, ...);
  Return x,y coordinates for browsers that
  do not recognize "javascript:xxx" from
  within frames like braindead MSIE

  input:  color,	'grey' or 'color'
	  ...server_update args (if used);

$html_text=hex_update($hex_color);
  Return the command and color number
  to the 'data' frame to force an update
  of the 'sample' frame and 'digits'

  input: hex color	# i.e. 6699CC

$rv = env_dumb_browser;
  Return true if $ENV{HTTP_USER_AGENT}
  contains a dumb browser

EXPORT

Top

  None by default.

AUTHOR

Top

Michael Robinton, michael@bizsystems.com

COPYRIGHT and LICENSE

Top


Graphics-ColorPicker documentation  | view source Contained in the Graphics-ColorPicker distribution.