From: A.M. K. <aku...@us...> - 2002-11-26 16:08:13
|
Update of /cvsroot/py-howto/pyhowto In directory sc8-pr-cvs1:/tmp/cvs-serv23454 Modified Files: curses.tex Log Message: Use American spelling of 'color', except in one place. Bump version number to 2.01 Index: curses.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/curses.tex,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -r1.21 -r1.22 *** curses.tex 26 Nov 2002 16:05:50 -0000 1.21 --- curses.tex 26 Nov 2002 16:08:10 -0000 1.22 *************** *** 3,7 **** \title{Curses Programming with Python} ! \release{2.0} \author{A.M. Kuchling \and\ Eric S. Raymond} --- 3,7 ---- \title{Curses Programming with Python} ! \release{2.01} \author{A.M. Kuchling \and\ Eric S. Raymond} *************** *** 267,271 **** Attributes allow displaying text in highlighted forms, such as in ! boldface, underline, reverse code, or in colour. They'll be explained in more detail in the next subsection. --- 267,271 ---- Attributes allow displaying text in highlighted forms, such as in ! boldface, underline, reverse code, or in color. They'll be explained in more detail in the next subsection. *************** *** 295,299 **** won't need to worry about leaving it in odd locations. ! \subsection{Attributes and Colour} Characters can be displayed in different ways. Status lines in a --- 295,299 ---- won't need to worry about leaving it in odd locations. ! \subsection{Attributes and Color} Characters can be displayed in different ways. Status lines in a *************** *** 328,353 **** \end{verbatim} ! The curses library also supports colour on those terminals that provide it, The most common such terminal is probably the Linux ! console, followed by colour xterms. ! To use colour, you must call the \function{start_color()} function soon after calling \function{initscr()}, to initialize the default ! colour set (the \function{curses.wrapper.wrapper()} function does this automatically). Once that's done, the \function{has_colors()} function returns TRUE if the terminal in use can actually display ! colour. (Note from amk: that curses uses the American spelling ! 'color', instead of the Canadian/British spelling 'colour'; if you're like me, you'll have to resign yourself to misspelling it for the sake of these functions.) ! The curses library maintains a finite number of colour pairs, ! containing a foreground (or text) colour and a background colour. You ! can get the attribute value corresponding to a colour pair with the \function{color_pair()} function; this can be bitwise-OR'ed with other attributes such as \constant{A_REVERSE}, but again, such combinations are not guaranteed to work on all terminals. ! An example, which displays a line of text using colour pair 1: \begin{verbatim} --- 328,353 ---- \end{verbatim} ! The curses library also supports color on those terminals that provide it, The most common such terminal is probably the Linux ! console, followed by color xterms. ! To use color, you must call the \function{start_color()} function soon after calling \function{initscr()}, to initialize the default ! color set (the \function{curses.wrapper.wrapper()} function does this automatically). Once that's done, the \function{has_colors()} function returns TRUE if the terminal in use can actually display ! color. (Note from AMK: curses uses the American spelling ! 'color', instead of the Canadian/British spelling 'colour'. If you're like me, you'll have to resign yourself to misspelling it for the sake of these functions.) ! The curses library maintains a finite number of color pairs, ! containing a foreground (or text) color and a background color. You ! can get the attribute value corresponding to a color pair with the \function{color_pair()} function; this can be bitwise-OR'ed with other attributes such as \constant{A_REVERSE}, but again, such combinations are not guaranteed to work on all terminals. ! An example, which displays a line of text using color pair 1: \begin{verbatim} *************** *** 356,373 **** \end{verbatim} ! As I said before, a colour pair consists of a foreground and ! background colour. \function{start_color()} initializes 8 basic ! colours when it activates colour mode. They are: 0:black, 1:red, 2:green, 3:yellow, 4:blue, 5:magenta, 6:cyan, and 7:white. The curses ! module defines named constants for each of these colours: \constant{curses.COLOR_BLACK}, \constant{curses.COLOR_RED}, and so forth. The \function{init_pair(\var{n, f, b})} function changes the ! definition of colour pair \var{n}, to foreground colour {f} and ! background colour {b}. Colour pair 0 is hard-wired to white on black, and cannot be changed. ! Let's put all this together. To change colour 1 to red text on a white background, you would call: --- 356,373 ---- \end{verbatim} ! As I said before, a color pair consists of a foreground and ! background color. \function{start_color()} initializes 8 basic ! colors when it activates color mode. They are: 0:black, 1:red, 2:green, 3:yellow, 4:blue, 5:magenta, 6:cyan, and 7:white. The curses ! module defines named constants for each of these colors: \constant{curses.COLOR_BLACK}, \constant{curses.COLOR_RED}, and so forth. The \function{init_pair(\var{n, f, b})} function changes the ! definition of color pair \var{n}, to foreground color {f} and ! background color {b}. Color pair 0 is hard-wired to white on black, and cannot be changed. ! Let's put all this together. To change color 1 to red text on a white background, you would call: *************** *** 376,382 **** \end{verbatim} ! When you change a colour pair, any text already displayed using that ! colour pair will change to the new colours. You can also display new ! text in this colour with: \begin{verbatim} --- 376,382 ---- \end{verbatim} ! When you change a color pair, any text already displayed using that ! color pair will change to the new colors. You can also display new ! text in this color with: \begin{verbatim} *************** *** 384,390 **** \end{verbatim} ! Very fancy terminals can change the definitions of the actual colours ! to a given RGB value. This lets you change colour 1, which is usually ! red, to purple or blue or any other colour you like. Unfortunately, the Linux console doesn't support this, so I'm unable to try it out, and can't provide any examples. You can check if your terminal can do --- 384,390 ---- \end{verbatim} ! Very fancy terminals can change the definitions of the actual colors ! to a given RGB value. This lets you change color 1, which is usually ! red, to purple or blue or any other color you like. Unfortunately, the Linux console doesn't support this, so I'm unable to try it out, and can't provide any examples. You can check if your terminal can do |