VGA Colors Applets

Home Up VNC2 Adafruit RGB LED Matrix Visual Spin YModem Wavetable Midi Player Prop EKG Basic Window/Form System PropMonitor 1-Bit Bitmaps 6-Bit Bitmaps DAC Sparkfun Nokia LCD Cameras MP3 Wireless JuiceBox I/O Expansion Via I2C Secure Digital (SD) Card Interface Notes on Graphics_Demo.spin ADC 2-Bit Bitmap App TV Colors Interleaved Character Generator 4-Color Character Applet VGA Colors Applets

 

bullet

Convert a hex value to 4-color palette:

bullet

Color Hex Input:  

Output:

   

Color # Hex Quat Bin Color
Color 1 (MSB)
Color 2
Color 3
Color 4 (LSB)
         

 

bullet

Generate Hex 4-color palette from RGB Component Picker

bullet

Input (as quaternary RGB triplet):       

Color #     Red      Green        Blue     Color  
Color 1 (MSB)  
Color 2  
Color 3  
Color 4 (LSB)  

Output:

        Hex:    

        Quat:   

        Bin:     

 

bullet

Notes

bullet

For the 1024x768 VGA tile driver:

bullet

2 longs are required for each text foreground/background color combo, arranged as:

bullet$ff_bb_ff_bb bullet$ff_ff_bb_bb bulletwhere 'ff' is the foreground color and 'bb' is the background color bullet2 longs needed because characters are in an interleaved pair bulletThe first long is the color for the first character in a pair, the second long is for the second character in a pair. bulletDemo routine "print()" only allows for 8 fore/back combinations (using longs 0 to 15)  

  bullet

1 long required for box colors,  arranged as:

bullet$tl_br_fi_bb bulletwhere 'tl' is top-left edge, 'br' is bottom-right edge, 'fi' is focus indicators, and 'bb' is background color bulletThe demo "box()" procedure hardwired to add 16 to input color number to pick box color and adds 5 to input color number to pick text color for box... bulletSo, "box(left,top,clr,str)" uses color number 16+clr for box colors and 5+clr for text color.  You probably want the 'bb' background colors of these two to match!  Note that this limits you to 4 box colors.

  bullet

1 long used for graphics colors, arranged as

bullet$00_11_22_33 bulletwhere 00,11,22,33 are the selectable graphics colors 0,1,2,3 bulletDemo hardwired to use the 21st long (last one) for the graphics colors 

  bullet

The Propeller's "tile driver" video uses 32-bit (long) values to define a four color palette

bullet

The "color_ptr" parameter, given to the tile driver, specifies the location of the data block of up to 64 different long palette values

bullet

Each long palette represents 4 different colors, one byte each.  Each color byte uses 2 bits for each primary colors, RGB, arranged as RGBx.  The "x" represents the two least significant bits, which are ignored.

bullet

Parallax gives this example of a 32-bit long palette, represented as a 16-digit quaternary (2-bit) number: 

bullet

 %%3330_0110_0020_3300 or $FC1408F0

bullet

The first byte, %%3330 (binary %11111100), is the color white

bullet

The second byte, %%0110, is the color dark cyan

 

Copyright ©2007  Raymond J. Allen