Commits

Anonymous committed e09754d

Added pygame2.colorpalettes documentation.

  • Participants
  • Parent commits e19d49b
  • Branches pgreloaded

Comments (0)

Files changed (3)

 
    ref/pygame2.rst
    ref/examples.rst
+   ref/pygame2_colorpalettes.rst
    ref/pygame2_font.rst
    ref/pygame2_freetype_base.rst
    ref/pygame2_mask.rst

doc/src/colorpalettes.xml

+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE module SYSTEM "api.dtd">
+
+<module name="pygame2.colorpalettes">
+  <alias>pygame2.colorpalettes</alias>
+  <short>Various, indexed color palettes</short>
+  <desc>
+    Indexed color palettes. The following palettes are currently
+    available:
+
+    +--------------------+---------------------------------------------------+
+    | MONOPALETTE        | 1-bit monochrome palette (black and white).       |
+    +--------------------+---------------------------------------------------+
+    | GRAY2PALETTE       | 2-bit grayscale palette with black, white and two |
+    |                    | shades of gray.                                   |
+    +--------------------+---------------------------------------------------+
+    | GRAY4PALETTE       | 4-bit grayscale palette with black, white and     |
+    |                    | 14 shades shades of gray.                         |
+    +--------------------+---------------------------------------------------+
+    | GRAY8PALETTE       | 8-bit grayscale palette with black, white and     |
+    |                    | 254 shades shades of gray.                        |
+    +--------------------+---------------------------------------------------+
+    | RGB3PALETTE        | 3-bit RGB color palette with pure red, green and  |
+    |                    | blue and their complementary colors as well as    |
+    |                    | black and white.                                  |
+    +--------------------+---------------------------------------------------+
+    | CGAPALETTE         | CGA color palette.                                |
+    +--------------------+---------------------------------------------------+
+    | EGAPALETTE         | EGA color palette.                                |
+    +--------------------+---------------------------------------------------+
+    | VGAPALETTE         | 8-bit VGA color palette.                          |
+    +--------------------+---------------------------------------------------+
+    | WEBPALETTE         | "Safe" web color palette with 225 colors.         |
+    +--------------------+---------------------------------------------------+
+  </desc>
+</module>
+

lib/colorpalettes.py

 
 """
 Various, indexed color palettes.
+
+Indexed color palettes. The following palettes are currently available:
+
++--------------------+---------------------------------------------------+
+| MONOPALETTE        | 1-bit monochrome palette (black and white).       |
++--------------------+---------------------------------------------------+
+| GRAY2PALETTE       | 2-bit grayscale palette with black, white and two |
+|                    | shades of gray.                                   |
++--------------------+---------------------------------------------------+
+| GRAY4PALETTE       | 4-bit grayscale palette with black, white and     |
+|                    | 14 shades shades of gray.                         |
++--------------------+---------------------------------------------------+
+| GRAY8PALETTE       | 8-bit grayscale palette with black, white and     |
+|                    | 254 shades shades of gray.                        |
++--------------------+---------------------------------------------------+
+| RGB3PALETTE        | 3-bit RGB color palette with pure red, green and  |
+|                    | blue and their complementary colors as well as    |
+|                    | black and white.                                  |
++--------------------+---------------------------------------------------+
+| CGAPALETTE         | CGA color palette.                                |
++--------------------+---------------------------------------------------+
+| EGAPALETTE         | EGA color palette.                                |
++--------------------+---------------------------------------------------+
+| VGAPALETTE         | 8-bit VGA color palette.                          |
++--------------------+---------------------------------------------------+
+| WEBPALETTE         | "Safe" web color palette with 225 colors.         |
++--------------------+---------------------------------------------------+
 """
 
 from pygame2.base import Color
 
 def _create_8bpp_gray ():
+    """Creates a 8 bit grayscale color palette."""
     l = []
     for x in range (0x00, 0xF1, 0x10):
         for y in range (0x00, 0x10, 0x01):