Background color. 
Author Message
 Background color.

Is there a way to read/detect/determine current background color in PB Dos 3.2?

Thanks for your attention!



Fri, 02 Jan 2004 21:43:19 GMT  
 Background color.
Get the internal variable pbvScrnTextAttr.

Use these functions to create forground and background COLOR arguments from
the returned value

FUNCTION MakeBack%(Att%) PUBLIC
' creates a background color from an integer attribute
  IF Att% > 127 THEN
    MakeBack% = (Att% - 128) \ 16
  ELSE
    MakeBack%  = Att% \16
  END IF
END FUNCTION

FUNCTION MakeFore% (Att%) PUBLIC
' Creates a foreground color from an integer attribute.
 LOCAL Work%
  Work% = Att% MOD 16
  IF Att% >= 128 THEN INCR Work%, 16            ' blink bit set.
  MakeFore% = Work%
END FUNCTION

Got the colors, but need the attribute?

FUNCTION MakeAtt%(Fore%,Back%) PUBLIC
' Creates the integer version of a video attribute, given foreground
' and background colors
  LOCAL Work%

  Work% = (16 * Back%) + (Fore% MOD 16)
  IF Fore% > 16 THEN INCR Work%, 16
  MakeAtt% = Work%

END FUNCTION

--
Michael Mattias
Tal Systems
Racine WI USA


Quote:

> Is there a way to read/detect/determine current background color in PB Dos
3.2?

> Thanks for your attention!



Sat, 03 Jan 2004 02:05:02 GMT  
 Background color.
DEFINT A - Z
CLS
  COLOR 1, 4                           ' blue on red
  LOCATE 1, 1                         ' upper left corner
  PRINT "This is a test"

  DEF SEG = &HB800            ' video segment address for color monitor
    attri = PEEK(1)                   ' color attribute (contains both,
foreground and background)
  DEF SEG                              ' restore default segment
  fore = attri MOD 16              ' foreground color of character "T"
  back = (attri - fore) \ 16        ' background color of char "T"
  PRINT STR$(back)
END

--
Egbert Zijlema
"Visit the Basic Guru pages"
http://www.basicguru.com/zijlema/

Quote:

> Is there a way to read/detect/determine current background color in PB Dos
3.2?

> Thanks for your attention!



Sat, 03 Jan 2004 06:32:47 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Setting a web hex color as background color for a canvas

2. conflicts between button colors and background color

3. Changing font color/size and background color with Tile

4. TreeView background color

5. List background color refresh...

6. Toolbar button background color

7. problem with background color

8. APL+Win Label background color

9. VW7: background color in IDE

10. Window Background Color

11. HELP: System Fonts and Background Color

12. Help with default background color

 

 
Powered by phpBB® Forum Software