1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
<html>
<title>color - Pygame Documentation</title>
<body bgcolor=#aaeebb text=#000000 link=#331111 vlink=#331111>
<table cellpadding=0 cellspacing=0 border=0 style='border: 3px solid black;' width='100%'>
<tr>
<td bgcolor='#c2fc20' style='padding: 6px;' align=center valign=center><a href='http://www.pygame.org/'><img src='../pygame_tiny.gif' border=0 width=200 height=60></a><br><b>pygame documentation</b></td>
<td bgcolor='#6aee28' style='border-left: 3px solid black; padding: 6px;' align=center valign=center>
||
<a href=http://www.pygame.org>Pygame Home</a> ||
<a href=../index.html>Help Contents</a> ||
<a href=index.html>Reference Index</a> ||
<br> <br>
<a href="cdrom.html">Cdrom</a> ||
<a href="color.html">Color</a> ||
<a href="cursors.html">Cursors</a> ||
<a href="display.html">Display</a> ||
<a href="draw.html">Draw</a> ||
<a href="event.html">Event</a> ||
<a href="font.html">Font</a> ||
<a href="image.html">Image</a> ||
<a href="joystick.html">Joystick</a> ||
<a href="key.html">Key</a> ||
<a href="mask.html">Mask</a> ||
<a href="mixer.html">Mixer</a> ||
<a href="mouse.html">Mouse</a> ||
<a href="movie.html">Movie</a> ||
<a href="music.html">Music</a> ||
<a href="overlay.html">Overlay</a> ||
<a href="pixelarray.html">Pixelarray</a> ||
<a href="pygame.html">Pygame</a> ||
<a href="rect.html">Rect</a> ||
<a href="scrap.html">Scrap</a> ||
<a href="sndarray.html">Sndarray</a> ||
<a href="sprite.html">Sprite</a> ||
<a href="surface.html">Surface</a> ||
<a href="surfarray.html">Surfarray</a> ||
<a href="time.html">Time</a> ||
<a href="transform.html">Transform</a>
</td></tr></table>
<br>
<a name="pygame.Color">
<big><b>pygame.Color</big></b><br><ul>
<i>pygame object for color representations</i><br>
<tt>pygame.Color(name): Return Color</tt><br>
<tt>pygame.Color(r, g, b, a): Return Color</tt><br>
<tt>pygame.Color(rgbvalue): Return Color</tt><br>
<ul><small><table>
<tr><td><a href="color.html#Color.r">Color.r</a> - <font size=-1>Gets or sets the red value of the Color.</font></td><td>Gets or sets the red value of the Color.</td></tr>
<tr><td><a href="color.html#Color.g">Color.g</a> - <font size=-1>Gets or sets the green value of the Color.</font></td><td>Gets or sets the green value of the Color.</td></tr>
<tr><td><a href="color.html#Color.b">Color.b</a> - <font size=-1>Gets or sets the blue value of the Color.</font></td><td>Gets or sets the blue value of the Color.</td></tr>
<tr><td><a href="color.html#Color.a">Color.a</a> - <font size=-1>Gets or sets the alpha value of the Color.</font></td><td>Gets or sets the alpha value of the Color.</td></tr>
<tr><td><a href="color.html#Color.cmy">Color.cmy</a> - <font size=-1>Gets or sets the CMY representation of the Color.</font></td><td>Gets or sets the CMY representation of the Color.</td></tr>
<tr><td><a href="color.html#Color.hsva">Color.hsva</a> - <font size=-1>Gets or sets the HSVA representation of the Color.</font></td><td>Gets or sets the HSVA representation of the Color.</td></tr>
<tr><td><a href="color.html#Color.hsla">Color.hsla</a> - <font size=-1>Gets or sets the HSLA representation of the Color.</font></td><td>Gets or sets the HSLA representation of the Color.</td></tr>
<tr><td><a href="color.html#Color.i1i2i3">Color.i1i2i3</a> - <font size=-1>Gets or sets the I1I2I3 representation of the Color.</font></td><td>Gets or sets the I1I2I3 representation of the Color.</td></tr>
<tr><td><a href="color.html#Color.normalize">Color.normalize</a> - <font size=-1>Returns the normalized RGBA values of the Color.</font></td><td>Returns the normalized RGBA values of the Color.</td></tr>
<tr><td><a href="color.html#Color.correct_gamma">Color.correct_gamma</a> - <font size=-1>Applies a certain gamma value to the Color.</font></td><td>Applies a certain gamma value to the Color.</td></tr>
</table></small></ul>
<p>The Color class represents <tt>RGBA</tt> color values using a value range of 0-255. It allows basic arithmetic operations to create new colors, supports conversions to other color spaces such as <tt>HSV</tt> or <tt>HSL</tt> and lets you adjust single color channels. </p>
<p>New in pygame <tt>1.8.1</tt>. </p>
<!--COMMENTS:pygame.Color--> <br>
<a name="Color.r">
<big><b>Color.r</big></b><br><ul>
<i>Gets or sets the red value of the Color.</i><br>
<tt>Color.r: Return int</tt><br>
<p>The red value of the Color. </p>
<!--COMMENTS:Color.r--> <br>
<br></ul>
<a name="Color.g">
<big><b>Color.g</big></b><br><ul>
<i>Gets or sets the green value of the Color.</i><br>
<tt>Color.g: Return int</tt><br>
<p>The green value of the Color. </p>
<!--COMMENTS:Color.g--> <br>
<br></ul>
<a name="Color.b">
<big><b>Color.b</big></b><br><ul>
<i>Gets or sets the blue value of the Color.</i><br>
<tt>Color.b: Return int</tt><br>
<p>The blue value of the Color. </p>
<!--COMMENTS:Color.b--> <br>
<br></ul>
<a name="Color.a">
<big><b>Color.a</big></b><br><ul>
<i>Gets or sets the alpha value of the Color.</i><br>
<tt>Color.a: Return int</tt><br>
<p>The alpha value of the Color. </p>
<!--COMMENTS:Color.a--> <br>
<br></ul>
<a name="Color.cmy">
<big><b>Color.cmy</big></b><br><ul>
<i>Gets or sets the CMY representation of the Color.</i><br>
<tt>Color.cmy: Return tuple</tt><br>
<p>The <tt>CMY</tt> representation of the Color. The <tt>CMY</tt> components are in the ranges <tt>C</tt> = [0, 1], <tt>M</tt> = [0, 1], <tt>Y</tt> = [0, 1]. Note that this will not return the absolutely exact <tt>CMY</tt> values for the set <tt>RGB</tt> values in all cases. Due to the <tt>RGB</tt> mapping from 0-255 and the <tt>CMY</tt> mapping from 0-1 rounding errors may cause the <tt>CMY</tt> values to differ slightly from what you might expect. </p>
<!--COMMENTS:Color.cmy--> <br>
<br></ul>
<a name="Color.hsva">
<big><b>Color.hsva</big></b><br><ul>
<i>Gets or sets the HSVA representation of the Color.</i><br>
<tt>Color.hsva: Return tuple</tt><br>
<p>The <tt>HSVA</tt> representation of the Color. The <tt>HSVA</tt> components are in the ranges <tt>H</tt> = [0, 360], <tt>S</tt> = [0, 100], <tt>V</tt> = [0, 100], <tt>A</tt> = [0, 100]. Note that this will not return the absolutely exact <tt>HSV</tt> values for the set <tt>RGB</tt> values in all cases. Due to the <tt>RGB</tt> mapping from 0-255 and the <tt>HSV</tt> mapping from 0-100 and 0-360 rounding errors may cause the <tt>HSV</tt> values to differ slightly from what you might expect. </p>
<!--COMMENTS:Color.hsva--> <br>
<br></ul>
<a name="Color.hsla">
<big><b>Color.hsla</big></b><br><ul>
<i>Gets or sets the HSLA representation of the Color.</i><br>
<tt>Color.hsla: Return tuple</tt><br>
<p>The <tt>HSLA</tt> representation of the Color. The <tt>HSLA</tt> components are in the ranges <tt>H</tt> = [0, 360], <tt>S</tt> = [0, 100], <tt>V</tt> = [0, 100], <tt>A</tt> = [0, 100]. Note that this will not return the absolutely exact <tt>HSL</tt> values for the set <tt>RGB</tt> values in all cases. Due to the <tt>RGB</tt> mapping from 0-255 and the <tt>HSL</tt> mapping from 0-100 and 0-360 rounding errors may cause the <tt>HSL</tt> values to differ slightly from what you might expect. </p>
<!--COMMENTS:Color.hsla--> <br>
<br></ul>
<a name="Color.i1i2i3">
<big><b>Color.i1i2i3</big></b><br><ul>
<i>Gets or sets the I1I2I3 representation of the Color.</i><br>
<tt>Color.i1i2i3: Return tuple</tt><br>
<p>The <tt>I1I2I3</tt> representation of the Color. The <tt>I1I2I3</tt> components are in the ranges <tt>I1</tt> = [0, 1], <tt>I2</tt> = <tt>[-0.5</tt>, <tt>0.5]</tt>, <tt>I3</tt> = <tt>[-0.5</tt>, <tt>0.5]</tt>. Note that this will not return the absolutely exact <tt>I1I2I3</tt> values for the set <tt>RGB</tt> values in all cases. Due to the <tt>RGB</tt> mapping from 0-255 and the <tt>I1I2I3</tt> mapping from 0-1 rounding errors may cause the <tt>I1I2I3</tt> values to differ slightly from what you might expect. </p>
<!--COMMENTS:Color.i1i2i3--> <br>
<br></ul>
<a name="Color.normalize">
<big><b>Color.normalize</big></b><br><ul>
<i>Returns the normalized RGBA values of the Color.</i><br>
<tt>Color.normalize(): Return tuple</tt><br>
<p>Returns the normalized <tt>RGBA</tt> values of the Color as floating point values. </p>
<!--COMMENTS:Color.normalize--> <br>
<br></ul>
<a name="Color.correct_gamma">
<big><b>Color.correct_gamma</big></b><br><ul>
<i>Applies a certain gamma value to the Color.</i><br>
<tt>Color.correct_gamma (gamma): Return Color</tt><br>
<p>Applies a certain gamma value to the Color and returns a new Color with the adjusted <tt>RGBA</tt> values. </p>
<!--COMMENTS:Color.correct_gamma--> <br>
<br></ul>
<br></ul>
</body></html>
|