home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / QBAS / PBC22B.ZIP / PBC$BAS.ZIP / GETCOLOR.BAS < prev    next >
BASIC Source File  |  1993-01-01  |  1KB  |  25 lines

  1. '   +----------------------------------------------------------------------+
  2. '   |                                                                      |
  3. '   |        PBClone  Copyright (c) 1990-1993  Thomas G. Hanlin III        |
  4. '   |                                                                      |
  5. '   +----------------------------------------------------------------------+
  6.  
  7.    DECLARE SUB UnCalcAttr (Foreground%, Background%, BYVAL VAttr%)
  8.  
  9. SUB GetColor (Fore%, Back%)
  10.    Row% = CSRLIN                            ' get current cursor position
  11.    Col% = POS(0)
  12.    Ch$ = CHR$(SCREEN(1, 1))                 ' save char and colors at 1, 1
  13.    VAttr% = SCREEN(1, 1, 1)
  14.    LOCATE 1, 1                              ' print char there in current color
  15.    PRINT Ch$;
  16.    DefAttr% = SCREEN(1, 1, 1)               ' get the current default color
  17.    UnCalcAttr Fore%, Back%, VAttr%          ' restore the old color
  18.    COLOR Fore%, Back%
  19.    LOCATE 1, 1
  20.    PRINT Ch$;
  21.    LOCATE Row%, Col%
  22.    UnCalcAttr Fore%, Back%, DefAttr%        ' return the current default color
  23.    COLOR Fore%, Back%                       ' restore it as the default
  24. END SUB
  25.