home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 31 / CDASC_31_1996_juillet_aout.iso / internet / rnr214.zip / COLORNMS.PAS < prev    next >
Pascal/Delphi Source File  |  1996-04-03  |  2KB  |  70 lines

  1. unit colornms;  { colornms.pas - map color names to numbers }
  2.  
  3. {
  4. Russell_Schulz@locutus.ofB.ORG (960403)
  5.  
  6. Copyright 1996 Russell Schulz
  7.  
  8. this code is not in the Public Domain
  9.  
  10. permission is granted to use these routines in any application regardless
  11. of commercial status as long as the author of these routines assumes no
  12. liability for any damages whatsoever for any reason.  have fun.
  13. }
  14.  
  15. interface
  16.  
  17. uses crt,genericf;
  18.  
  19. function colortoi(acolorstring: string): integer;
  20.  
  21. implementation
  22.  
  23. function colortoi;
  24.  
  25. var
  26.   result: integer;
  27.   lowcolor: string;
  28.  
  29. begin
  30.   result := 0;
  31.  
  32.   lowcolor := lower(trim(ltrim(acolorstring)));
  33.  
  34.   if lowcolor='black' then result := black
  35.   else if lowcolor='blue' then result := blue
  36.   else if lowcolor='green' then result := green
  37.   else if lowcolor='cyan' then result := cyan
  38.   else if lowcolor='red' then result := red
  39.   else if lowcolor='magenta' then result := magenta
  40.   else if lowcolor='brown' then result := brown
  41.   else if lowcolor='lightgray' then result := lightgray
  42.   else if lowcolor='lightgrey' then result := lightgray
  43.   else if lowcolor='light-gray' then result := lightgray
  44.   else if lowcolor='light-grey' then result := lightgray
  45.   else if lowcolor='darkgray' then result := darkgray
  46.   else if lowcolor='darkgrey' then result := darkgray
  47.   else if lowcolor='dark-gray' then result := darkgray
  48.   else if lowcolor='dark-grey' then result := darkgray
  49.   else if lowcolor='lightblue' then result := lightblue
  50.   else if lowcolor='light-blue' then result := lightblue
  51.   else if lowcolor='lightgreen' then result := lightgreen
  52.   else if lowcolor='light-green' then result := lightgreen
  53.   else if lowcolor='lightcyan' then result := lightcyan
  54.   else if lowcolor='light-cyan' then result := lightcyan
  55.   else if lowcolor='lightred' then result := lightred
  56.   else if lowcolor='light-red' then result := lightred
  57.   else if lowcolor='lightmagenta' then result := lightmagenta
  58.   else if lowcolor='light-magenta' then result := lightmagenta
  59.   else if lowcolor='yellow' then result := yellow
  60.   else if lowcolor='white' then result := white
  61.   else
  62.     begin
  63.       result := atoi(lowcolor);
  64.     end;
  65.  
  66.   colortoi := result;
  67. end;
  68.  
  69. end.
  70.