fg/bg colors

 BBS: Inland Empire Archive
Date: 12-31-92 (23:10)             Number: 385
From: HARRY GISH                   Refer#: NONE
  To: JOHN GALLAS                   Recvd: NO  
Subj: fg/bg colors                   Conf: (2) Quik_Bas
* In a message originally to All, John Gallas said:
 > I know I can take a foreground and background color, and make
 > them into
 > a 1 byte string, but can I take that 1 byte string and get a
 > foreground/background color?
 >
Assuming 16 colors, I'd do it this way :

Color% = Foreground% * 16 + Background%
Color$ = CHR$(Color%)

to encode, and

Color% = ASC(Color$)
Foreground% = Color% / 16
Background% = Color% MOD 16
---
 * Origin: The shipyard * Home of QuickShare * Dallas, TX
(214)686-1962 (1:124/
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET