Commits

sirgazil committed d000ee5 Draft

Reviewing docstrings (see #6)

  • Participants
  • Parent commits 2ccae05

Comments (0)

Files changed (1)

File colorin/cli.py

 This module provides some classes to format, color and control text
 output in text terminals using ANSI escape sequences.
 
-For more information `read about ANSI escape sequences <http://en.wikipedia.org/wiki/ANSI_escape_code>`_.
-
 """
 
 import sys
 
 
 class Display(object):
-    """Represent the terminal screen.
+    """Represents a terminal screen.
 
     Instances of this class provide the main methods for manipulating
-    cursor position, erase the screen, update and append output and
-    display mode such as forground and background colors.
+    cursor position, erase the screen, update and append output, and
+    display mode such as foreground and background colors.
 
     """    
     def __init__(self):
     def turn_bold(self):
         """Turn all new text output bold.
         
-        Text will be displayed bold until the turn_fx_off() function is
-        called.
+        This method tells the display to show all subsequent text in bold
+        until the :py:meth:`Display.turn_fx_off()` method is called.
         
         """
         sys.stdout.write("\033[1m")
 
     def turn_fx_off(self):
-        """Turn all attributes off."""
+        """Turn all attributes off.
+        
+        Normally used after calling :py:meth:`Display.turn_bold()`,
+        :py:meth:`Display.set_fg_color()` or
+        :py:meth:`Display.set_bg_color()`.
+        
+        """
         sys.stdout.write("\033[0m")
 
     def erase(self):
         sys.stdout.write("\033[2J")
 
     def set_fg_color(self, color):
-        """Set forground color.
+        """Set foreground color for all text.
+        
+        This method tells the display to show all subsequent text in the
+        ``color`` indicated until the :py:meth:`Display.turn_fx_off()`
+        method is called.
 
-        Parameters:
+        Parameters
 
-        color (str) -- The name of the color. It can be Black, Red,
-        Green, Yellow, Blue, Magenta, Cyan and White.
+        ``color`` (str): the name of the color. It can be Black, Red, Green,
+        Yellow, Blue, Magenta, Cyan and White.
 
         """
         colors = {"Black": 30, "Red": 31, "Green": 32, "Yellow": 33,
             sys.stdout.write("\033[{0}m".format(colors[color]))
 
     def set_bg_color(self, color):
-        """Set background color.
+        """Set background color for all text.
+        
+        This method tells the display to show all subsequent text background
+        in the ``color`` indicated until the :py:meth:`Display.turn_fx_off()`
+        method is called.
 
-        Parameters:
+        Parameters
 
-        color (str) -- The name of the color. It can be Black, Red,
-        Green, Yellow, Blue, Magenta, Cyan and White.
+        ``color`` (str): the name of the color. It can be Black, Red, Green,
+        Yellow, Blue, Magenta, Cyan and White.
 
         """
         colors = {"Black": 40, "Red": 41, "Green": 42, "Yellow": 43,