474 lines
28 KiB
HTML
474 lines
28 KiB
HTML
|
<!DOCTYPE html>
|
||
|
|
||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
|
<head>
|
||
|
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<title>Color Class — Ren'Py Documentation</title>
|
||
|
<link rel="stylesheet" href="_static/renpydoc.css" type="text/css" />
|
||
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||
|
<link rel="stylesheet" type="text/css" href="_static/bootstrap-3.3.6/css/bootstrap.min.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="_static/bootstrap-3.3.6/css/bootstrap-theme.min.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="_static/bootstrap-sphinx.css" />
|
||
|
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
|
||
|
<script type="text/javascript" src="_static/jquery.js"></script>
|
||
|
<script type="text/javascript" src="_static/underscore.js"></script>
|
||
|
<script type="text/javascript" src="_static/doctools.js"></script>
|
||
|
<script type="text/javascript" src="_static/language_data.js"></script>
|
||
|
<script type="text/javascript" src="_static/js/jquery-1.11.0.min.js"></script>
|
||
|
<script type="text/javascript" src="_static/js/jquery-fix.js"></script>
|
||
|
<script type="text/javascript" src="_static/bootstrap-3.3.6/js/bootstrap.min.js"></script>
|
||
|
<script type="text/javascript" src="_static/bootstrap-sphinx.js"></script>
|
||
|
<link rel="index" title="Index" href="genindex.html" />
|
||
|
<link rel="search" title="Search" href="search.html" />
|
||
|
<link rel="next" title="Matrix" href="matrix.html" />
|
||
|
<link rel="prev" title="File Access" href="file_python.html" />
|
||
|
<meta charset='utf-8'>
|
||
|
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
|
||
|
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
|
||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||
|
|
||
|
</head><body>
|
||
|
|
||
|
<div id="navbar" class="navbar navbar-default navbar-fixed-top">
|
||
|
<div class="container">
|
||
|
<div class="navbar-header">
|
||
|
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
|
||
|
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
|
||
|
<span class="icon-bar"></span>
|
||
|
<span class="icon-bar"></span>
|
||
|
<span class="icon-bar"></span>
|
||
|
</button>
|
||
|
<a class="navbar-brand" href="index.html">
|
||
|
Ren'Py Documentation</a>
|
||
|
<span class="navbar-text navbar-version pull-left"><b>7.5.3</b></span>
|
||
|
</div>
|
||
|
|
||
|
<div class="collapse navbar-collapse nav-collapse">
|
||
|
<ul class="nav navbar-nav">
|
||
|
|
||
|
<li><a href="https://www.renpy.org">Home Page</a></li>
|
||
|
<li><a href="https://www.renpy.org/doc/html/">Online Documentation</a></li>
|
||
|
|
||
|
|
||
|
<li class="dropdown globaltoc-container">
|
||
|
<a role="button"
|
||
|
id="dLabelGlobalToc"
|
||
|
data-toggle="dropdown"
|
||
|
data-target="#"
|
||
|
href="index.html">Site <b class="caret"></b></a>
|
||
|
<ul class="dropdown-menu globaltoc"
|
||
|
role="menu"
|
||
|
aria-labelledby="dLabelGlobalToc"><ul>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="quickstart.html">Quickstart</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="gui.html">GUI Customization Guide</a></li>
|
||
|
</ul>
|
||
|
<ul>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="language_basics.html">Language Basics</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="label.html">Labels & Control Flow</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="dialogue.html">Dialogue and Narration</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="displaying_images.html">Displaying Images</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="menus.html">In-Game Menus</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="python.html">Python Statements</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="conditional.html">Conditional Statements</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="audio.html">Audio</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="movie.html">Movie</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="voice.html">Voice</a></li>
|
||
|
</ul>
|
||
|
<ul>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="text.html">Text</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="translation.html">Translation</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="displayables.html">Displayables</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="transforms.html">Transforms</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="transitions.html">Transitions</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="atl.html">Animation and Transformation Language</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="matrixcolor.html">Matrixcolor</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="layeredimage.html">Layered Images</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="3dstage.html">3D Stage</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="live2d.html">Live2D Cubism</a></li>
|
||
|
</ul>
|
||
|
<ul>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="style.html">Styles</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="style_properties.html">Style Properties</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="screens.html">Screens and Screen Language</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="screen_actions.html">Screen Actions, Values, and Functions</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="screen_special.html">Special Screen Names</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="screen_optimization.html">Screen Language Optimization</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="config.html">Configuration Variables</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="preferences.html">Preference Variables</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="store_variables.html">Store Variables</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="mouse.html">Custom Mouse Cursors</a></li>
|
||
|
</ul>
|
||
|
<ul>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="launcher.html">Launcher</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="developer_tools.html">Developer Tools</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="director.html">Interactive Director</a></li>
|
||
|
</ul>
|
||
|
<ul>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="nvl_mode.html">NVL-Mode Tutorial</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="input.html">Text Input</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="side_image.html">Side Images</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="rooms.html">Image Gallery, Music Room, and Replay Actions</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="drag_drop.html">Drag and Drop</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="sprites.html">Sprites</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="keymap.html">Customizing the Keymap</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="achievement.html">Achievements</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="history.html">Dialogue History</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="multiple.html">Multiple Character Dialogue</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="splashscreen_presplash.html">Splashscreen and Presplash</a></li>
|
||
|
</ul>
|
||
|
<ul class="current">
|
||
|
<li class="toctree-l1"><a class="reference internal" href="statement_equivalents.html">Statement Equivalents</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="save_load_rollback.html">Saving, Loading, and Rollback</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="persistent.html">Persistent Data</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="trans_trans_python.html">Transforms and Transitions in Python</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="gui_advanced.html">Advanced GUI</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="screen_python.html">Screens and Python</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="modes.html">Modes</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="cdd.html">Creator-Defined Displayables</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="cds.html">Creator-Defined Statements</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="custom_text_tags.html">Custom Text Tags</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="character_callbacks.html">Character Callbacks</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="file_python.html">File Access</a></li>
|
||
|
<li class="toctree-l1 current"><a class="current reference internal" href="#">Color Class</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="matrix.html">Matrix</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="model.html">Model-Based Rendering</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="other.html">Other Functions and Variables</a></li>
|
||
|
</ul>
|
||
|
<ul>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="build.html">Building Distributions</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="updater.html">Web Updater</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="android.html">Android</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="chromeos.html">Chrome OS/Chromebook</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="ios.html">iOS</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="iap.html">In-App Purchasing</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="gesture.html">Gestures</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="raspi.html">Raspberry Pi</a></li>
|
||
|
</ul>
|
||
|
<ul>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="security.html">Security</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="problems.html">Dealing with Problems</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="environment_variables.html">Environment Variables</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="self_voicing.html">Self-Voicing</a></li>
|
||
|
</ul>
|
||
|
<ul>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="editor.html">Text Editor Integration</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="skins.html">Skins</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="translating_renpy.html">Translating Ren'Py</a></li>
|
||
|
</ul>
|
||
|
<ul>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="changelog.html">Changelog (Ren'Py 7.x-)</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="changelog6.html">Changelog (Ren'Py 6.11 - 6.99)</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="incompatible.html">Incompatible Changes</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="distributor.html">Distributor Notes</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="license.html">License</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="credits.html">Credits</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="sponsors.html">Ren'Py Development Sponsors</a></li>
|
||
|
</ul>
|
||
|
<ul>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="thequestion.html">Script of The Question</a></li>
|
||
|
<li class="toctree-l1"><a class="reference internal" href="thequestion_nvl.html">NVL-mode script for The Question</a></li>
|
||
|
</ul>
|
||
|
</ul>
|
||
|
</li>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
|
||
|
|
||
|
<form class="navbar-form navbar-right" action="search.html" method="get">
|
||
|
<div class="form-group">
|
||
|
<input type="text" name="q" class="form-control" placeholder="Search" />
|
||
|
</div>
|
||
|
<input type="hidden" name="check_keywords" value="yes" />
|
||
|
<input type="hidden" name="area" value="default" />
|
||
|
</form>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="container">
|
||
|
<div class="row">
|
||
|
<div class="col-md-3">
|
||
|
<div id="sidebar" class="bs-sidenav" role="complementary"><ul>
|
||
|
<li><a class="reference internal" href="#">Color Class</a></li>
|
||
|
</ul>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="col-md-9 content">
|
||
|
|
||
|
<div class="section" id="color-class">
|
||
|
<h1>Color Class<a class="headerlink" href="#color-class" title="Permalink to this headline"> link</a></h1>
|
||
|
<p>Ren'Py has a Color class that can be used for converting from one color
|
||
|
space to another, or performing various color theory operations. Colors
|
||
|
are immutable, and can be used wherever a color tuple can be used.</p>
|
||
|
<p>Color tuples operate in one of three color spaces.</p>
|
||
|
<ul class="simple">
|
||
|
<li>RGB - Red, Green, Blue</li>
|
||
|
<li>HLS - Hue, Lightness, Saturation</li>
|
||
|
<li>HSV - Hue, Saturation, Value</li>
|
||
|
</ul>
|
||
|
<p>As an example of some of the calculations that can be performed, all of
|
||
|
the following colors are bright green:</p>
|
||
|
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="c1"># Standard Ren'Py Colors.</span>
|
||
|
<span class="n">Color</span><span class="p">(</span><span class="s2">"#0f0"</span><span class="p">)</span>
|
||
|
<span class="n">Color</span><span class="p">(</span><span class="s2">"#00ff00"</span><span class="p">)</span>
|
||
|
<span class="n">Color</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">))</span>
|
||
|
|
||
|
<span class="c1"># Convert from other color spaces.</span>
|
||
|
<span class="n">Color</span><span class="p">(</span><span class="n">hls</span><span class="o">=</span><span class="p">(</span><span class="o">.</span><span class="mi">333</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">))</span>
|
||
|
<span class="n">Color</span><span class="p">(</span><span class="n">hsv</span><span class="o">=</span><span class="p">(</span><span class="o">.</span><span class="mi">333</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">))</span>
|
||
|
|
||
|
<span class="c1"># Turns red into green via a method that returns a new color.</span>
|
||
|
<span class="n">Color</span><span class="p">(</span><span class="s2">"#f00"</span><span class="p">)</span><span class="o">.</span><span class="n">rotate_hue</span><span class="p">(</span><span class="o">.</span><span class="mi">333</span><span class="p">)</span>
|
||
|
</pre></div>
|
||
|
</div>
|
||
|
<dl class="class">
|
||
|
<dt id="Color">
|
||
|
<em class="property">class </em><code class="descname">Color</code><span class="sig-paren">(</span><em>color=None</em>, <em>hls=None</em>, <em>hsv=None</em>, <em>rgb=None</em>, <em>alpha=1.0</em><span class="sig-paren">)</span><a class="headerlink" href="#Color" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>The Color class is used to represent and manipulate colors and convert
|
||
|
between various color spaces. It also represents opacity in the form
|
||
|
of an alpha.</p>
|
||
|
<p>When creating a Color, at one of the <cite>color</cite>, <cite>hls</cite>, <cite>hsv</cite>, or <cite>rgb</cite>
|
||
|
arguments should be supplied. (If all are None, None is returned.)</p>
|
||
|
<dl class="docutils">
|
||
|
<dt><cite>color</cite></dt>
|
||
|
<dd><p class="first">The color, in one of the standard formats Ren'Py understands. These
|
||
|
are:</p>
|
||
|
<ul class="last simple">
|
||
|
<li>A Color object.</li>
|
||
|
<li>An (r, g, b) or (r, g, b, a) tuple, in which all the numbers are
|
||
|
between 0 and 255.</li>
|
||
|
<li>A string giving a hexadecimal color, in the form "#rgb", "#rgba",
|
||
|
"#rrggbb", or "#rrggbbaa".</li>
|
||
|
</ul>
|
||
|
</dd>
|
||
|
<dt><cite>hls</cite></dt>
|
||
|
<dd>A color in the hue-lightness-saturation color space. This should
|
||
|
be supplied a three-component tuple, where each component is between
|
||
|
0.0 and 1.0.</dd>
|
||
|
<dt><cite>hsv</cite></dt>
|
||
|
<dd>A color in the hue-saturation-value color space. This should
|
||
|
be supplied a three-component tuple, where each component is between
|
||
|
0.0 and 1.0.</dd>
|
||
|
<dt><cite>rgb</cite></dt>
|
||
|
<dd>A color in the red-green-blue color space. This should
|
||
|
be supplied a three-component tuple, where each component is between
|
||
|
0.0 and 1.0.</dd>
|
||
|
</dl>
|
||
|
<p>If the supplied color does not contain an alpha value, <cite>alpha</cite> is used.
|
||
|
<cite>alpha</cite> must be between 0.0 and 1.0.</p>
|
||
|
<p>Color objects can be used as 4-component tuples, where the components
|
||
|
are (red, green, blue, and alpha). When used as a tuple, the value
|
||
|
of each component is between 0 and 255.</p>
|
||
|
<p>Color objects support the +, -, and * operators, representing
|
||
|
component-wise addition, subtraction, and multiplication. Some uses
|
||
|
of these operators can cause the creation of colors with components
|
||
|
that are not in the supported range. Such colors should not be passed
|
||
|
to other parts of Ren'Py. (The normalize method can be called to return
|
||
|
a new color with the components limited to the proper range.)</p>
|
||
|
<p>A Color object has the following properties:</p>
|
||
|
<dl class="attribute">
|
||
|
<dt id="Color.hls">
|
||
|
<code class="descname">hls</code><a class="headerlink" href="#Color.hls" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns the color as a tuple of three floating point numbers giving
|
||
|
hue, lightness, and saturation. Each component ranges between 0.0 and 1.0.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="attribute">
|
||
|
<dt id="Color.hsv">
|
||
|
<code class="descname">hsv</code><a class="headerlink" href="#Color.hsv" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns the color as a tuple of three floating point numbers giving
|
||
|
hue, saturation, and value. Each component ranges between 0.0 and 1.0.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="attribute">
|
||
|
<dt id="Color.rgb">
|
||
|
<code class="descname">rgb</code><a class="headerlink" href="#Color.rgb" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns the color as a tuple of three floating point numbers giving
|
||
|
the red, green, and blue components. Each component ranges between 0.0
|
||
|
and 1.0.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="attribute">
|
||
|
<dt id="Color.rgba">
|
||
|
<code class="descname">rgba</code><a class="headerlink" href="#Color.rgba" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns the color as a tuple of four floating point numbers giving
|
||
|
the red, green, blue and alpha components as 0.0 to 1.0 values.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="attribute">
|
||
|
<dt id="Color.alpha">
|
||
|
<code class="descname">alpha</code><a class="headerlink" href="#Color.alpha" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns the alpha (opacity) of this Color as a number between 0.0 and
|
||
|
1.0, where 0.0 is transparent and 1.0 is opaque.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="attribute">
|
||
|
<dt id="Color.hexcode">
|
||
|
<code class="descname">hexcode</code><a class="headerlink" href="#Color.hexcode" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns a string containing a hex color code of the form #rrggbbaa
|
||
|
or #rrggbb.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<p>Color objects have the following methods. Since Colors are immutable,
|
||
|
these methods always return a new Color object.</p>
|
||
|
<dl class="method">
|
||
|
<dt id="Color.interpolate">
|
||
|
<code class="descname">interpolate</code><span class="sig-paren">(</span><em>other</em>, <em>fraction</em><span class="sig-paren">)</span><a class="headerlink" href="#Color.interpolate" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Interpolates between this Color and <cite>other</cite> in the RGB color
|
||
|
space, returning a new Color as the result. If <cite>fraction</cite> is 0.0, the
|
||
|
result is the same as this color, if 1.0, it is the same as <cite>other</cite>.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="Color.interpolate_hls">
|
||
|
<code class="descname">interpolate_hls</code><span class="sig-paren">(</span><em>other</em>, <em>fraction</em><span class="sig-paren">)</span><a class="headerlink" href="#Color.interpolate_hls" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Interpolates between this Color and <cite>other</cite> in the HLS color
|
||
|
space, returning a new Color as the result. If <cite>fraction</cite> is 0.0, the
|
||
|
result is the same as this color, if 1.0, it is the same as <cite>other</cite>.</p>
|
||
|
<p><cite>other</cite> may be a string, Color or an HLS tuple.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="Color.interpolate_hsv">
|
||
|
<code class="descname">interpolate_hsv</code><span class="sig-paren">(</span><em>other</em>, <em>fraction</em><span class="sig-paren">)</span><a class="headerlink" href="#Color.interpolate_hsv" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Interpolates between this Color and <cite>other</cite> in the HSV color
|
||
|
space, returning a new Color as the result. If <cite>fraction</cite> is 0.0, the
|
||
|
result is the same as this color, if 1.0, it is the same as <cite>other</cite>.</p>
|
||
|
<p><cite>other</cite> may be a string, Color or an HSV tuple.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="Color.multiply_hls_saturation">
|
||
|
<code class="descname">multiply_hls_saturation</code><span class="sig-paren">(</span><em>saturation</em><span class="sig-paren">)</span><a class="headerlink" href="#Color.multiply_hls_saturation" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Multiplies this color's saturation by <cite>saturation</cite>, and returns
|
||
|
the result as a new Color. This is performed in the HLS color space.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="Color.multiply_hsv_saturation">
|
||
|
<code class="descname">multiply_hsv_saturation</code><span class="sig-paren">(</span><em>saturation</em><span class="sig-paren">)</span><a class="headerlink" href="#Color.multiply_hsv_saturation" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Multiplies this color's saturation by <cite>saturation</cite>, and returns
|
||
|
the result as a new Color. This is performed in the HSV color space.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="Color.multiply_value">
|
||
|
<code class="descname">multiply_value</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#Color.multiply_value" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Multiples this color's value by <cite>value</cite> and returns the result as a
|
||
|
new Color. This is performed in the HSV color space.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="Color.normalize">
|
||
|
<code class="descname">normalize</code><span class="sig-paren">(</span><em>self</em><span class="sig-paren">)</span><a class="headerlink" href="#Color.normalize" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Returns a normalized version of this Color where all components fall
|
||
|
between 0 and 255.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="Color.opacity">
|
||
|
<code class="descname">opacity</code><span class="sig-paren">(</span><em>opacity</em><span class="sig-paren">)</span><a class="headerlink" href="#Color.opacity" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Multiplies the alpha channel of this color by <cite>opacity</cite>, and returns
|
||
|
the new color.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="Color.replace_hls_saturation">
|
||
|
<code class="descname">replace_hls_saturation</code><span class="sig-paren">(</span><em>saturation</em><span class="sig-paren">)</span><a class="headerlink" href="#Color.replace_hls_saturation" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Replaces this color's saturation with <cite>saturation</cite>, and returns
|
||
|
the result as a new Color. This is performed in the HLS color space.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="Color.replace_hsv_saturation">
|
||
|
<code class="descname">replace_hsv_saturation</code><span class="sig-paren">(</span><em>saturation</em><span class="sig-paren">)</span><a class="headerlink" href="#Color.replace_hsv_saturation" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Replace this color's saturation with <cite>saturation</cite>, and returns
|
||
|
the result as a new Color. This is performed in the HSV color space.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="Color.replace_hue">
|
||
|
<code class="descname">replace_hue</code><span class="sig-paren">(</span><em>hue</em><span class="sig-paren">)</span><a class="headerlink" href="#Color.replace_hue" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Replaces this color's hue with <cite>hue</cite>, which should be between 0.0 and
|
||
|
1.0. Returns the new Color.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="Color.replace_lightness">
|
||
|
<code class="descname">replace_lightness</code><span class="sig-paren">(</span><em>lightness</em><span class="sig-paren">)</span><a class="headerlink" href="#Color.replace_lightness" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Replaces this color's lightness with <cite>lightness</cite>, and returns
|
||
|
the result as a new Color. This is performed in the HLS color space.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="Color.replace_opacity">
|
||
|
<code class="descname">replace_opacity</code><span class="sig-paren">(</span><em>opacity</em><span class="sig-paren">)</span><a class="headerlink" href="#Color.replace_opacity" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Replaces this color's alpha channel with <cite>opacity</cite>, and
|
||
|
returns the result as a new Color.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="Color.replace_value">
|
||
|
<code class="descname">replace_value</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#Color.replace_value" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Replaces this color's value with <cite>value</cite> and returns the result as a
|
||
|
new Color. This is performed in the HSV color space.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="Color.rotate_hue">
|
||
|
<code class="descname">rotate_hue</code><span class="sig-paren">(</span><em>rotation</em><span class="sig-paren">)</span><a class="headerlink" href="#Color.rotate_hue" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Rotates this color's hue by <cite>rotation</cite>, and returns the new Color. <cite>rotation</cite>
|
||
|
is a fraction of a full rotation (between 0.0 and 1.0). Divide by 360.0 to
|
||
|
convert to degrees.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="Color.shade">
|
||
|
<code class="descname">shade</code><span class="sig-paren">(</span><em>fraction</em><span class="sig-paren">)</span><a class="headerlink" href="#Color.shade" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Creates a shade of this color by mixing it with black. <cite>fraction</cite> is
|
||
|
the fraction of this color that is in the new color. If <cite>fraction</cite> is
|
||
|
1.0, the color is unchanged, if 0.0, black is returned.</p>
|
||
|
<p>The alpha channel is unchanged.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
<dl class="method">
|
||
|
<dt id="Color.tint">
|
||
|
<code class="descname">tint</code><span class="sig-paren">(</span><em>fraction</em><span class="sig-paren">)</span><a class="headerlink" href="#Color.tint" title="Permalink to this definition"> link</a></dt>
|
||
|
<dd><p>Creates a tint of this color by mixing it with white. <cite>fraction</cite> is
|
||
|
the fraction of this color that is in the new color. If <cite>fraction</cite> is
|
||
|
1.0, the color is unchanged, if 0.0, white is returned.</p>
|
||
|
<p>The alpha channel is unchanged.</p>
|
||
|
</dd></dl>
|
||
|
|
||
|
</dd></dl>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
<footer class="footer">
|
||
|
<div class="container">
|
||
|
<p class="pull-right">
|
||
|
<a href="#">Back to top</a>
|
||
|
|
||
|
</p>
|
||
|
<p>
|
||
|
© Copyright 2012-2022, Tom Rothamel.<br/>
|
||
|
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.8.6.<br/>
|
||
|
</p>
|
||
|
</div>
|
||
|
</footer>
|
||
|
</body>
|
||
|
</html>
|