UNPKG

rot-js

Version:

A roguelike toolkit in JavaScript

21 lines 34.1 kB
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>color | rot.js</title><meta name="description" content="Documentation for rot.js"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">rot.js</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label><input type="checkbox" id="tsd-filter-externals" checked/><label class="tsd-widget" for="tsd-filter-externals">Externals</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><ul class="tsd-breadcrumb"><li><a href="../index.html">rot.js</a></li><li><a href="color.html">color</a></li></ul><h1>Module color</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Type aliases</h3><ul class="tsd-index-list"><li class="tsd-kind-type-alias tsd-parent-kind-module"><a href="color.html#Color" class="tsd-kind-icon">Color</a></li></ul></section><section class="tsd-index-section "><h3>Functions</h3><ul class="tsd-index-list"><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#add" class="tsd-kind-icon">add</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#add_" class="tsd-kind-icon">add_</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#fromString" class="tsd-kind-icon">from<wbr/>String</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#hsl2rgb" class="tsd-kind-icon">hsl2rgb</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#interpolate" class="tsd-kind-icon">interpolate</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#interpolateHSL" class="tsd-kind-icon">interpolateHSL</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#lerp" class="tsd-kind-icon">lerp</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#lerpHSL" class="tsd-kind-icon">lerpHSL</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#multiply" class="tsd-kind-icon">multiply</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#multiply_" class="tsd-kind-icon">multiply_</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#randomize" class="tsd-kind-icon">randomize</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#rgb2hsl" class="tsd-kind-icon">rgb2hsl</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#toHex" class="tsd-kind-icon">to<wbr/>Hex</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#toRGB" class="tsd-kind-icon">toRGB</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Type aliases</h2><section class="tsd-panel tsd-member tsd-kind-type-alias tsd-parent-kind-module"><a id="Color" class="tsd-anchor"></a><h3>Color</h3><div class="tsd-signature tsd-kind-icon">Color<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">]</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/ondras/rot.js/blob/394b3e4/src/color.ts#L4">color.ts:4</a></li></ul></aside></section></section><section class="tsd-panel-group tsd-member-group "><h2>Functions</h2><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"><a id="add" class="tsd-anchor"></a><h3>add</h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"><li class="tsd-signature tsd-kind-icon">add<span class="tsd-signature-symbol">(</span>color1<span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a>, <span class="tsd-signature-symbol">...</span>colors<span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/ondras/rot.js/blob/394b3e4/src/color.ts#L40">color.ts:40</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> <p>Add two or more colors</p> </div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>color1: <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h5></li><li><h5><span class="tsd-flag ts-flagRest">Rest</span> <span class="tsd-signature-symbol">...</span>colors: <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"><a id="add_" class="tsd-anchor"></a><h3>add_</h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"><li class="tsd-signature tsd-kind-icon">add_<span class="tsd-signature-symbol">(</span>color1<span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a>, <span class="tsd-signature-symbol">...</span>colors<span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/ondras/rot.js/blob/394b3e4/src/color.ts#L53">color.ts:53</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> <p>Add two or more colors, MODIFIES FIRST ARGUMENT</p> </div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>color1: <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h5></li><li><h5><span class="tsd-flag ts-flagRest">Rest</span> <span class="tsd-signature-symbol">...</span>colors: <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"><a id="fromString" class="tsd-anchor"></a><h3>from<wbr/>String</h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"><li class="tsd-signature tsd-kind-icon">from<wbr/>String<span class="tsd-signature-symbol">(</span>str<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/ondras/rot.js/blob/394b3e4/src/color.ts#L6">color.ts:6</a></li></ul></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>str: <span class="tsd-signature-type">string</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"><a id="hsl2rgb" class="tsd-anchor"></a><h3>hsl2rgb</h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"><li class="tsd-signature tsd-kind-icon">hsl2rgb<span class="tsd-signature-symbol">(</span>color<span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/ondras/rot.js/blob/394b3e4/src/color.ts#L167">color.ts:167</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> <p>Converts an HSL color value to RGB. Expects 0..1 inputs, produces 0..255 outputs.</p> </div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>color: <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h5></li></ul><h4 class="tsd-returns-title">Returns <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"><a id="interpolate" class="tsd-anchor"></a><h3>interpolate</h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"><li class="tsd-signature tsd-kind-icon">interpolate<span class="tsd-signature-symbol">(</span>color1<span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a>, color2<span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a>, factor<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/ondras/rot.js/blob/394b3e4/src/color.ts#L92">color.ts:92</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> <p>Interpolate (blend) two colors with a given factor</p> </div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>color1: <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h5></li><li><h5>color2: <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h5></li><li><h5>factor: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 0.5</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"><a id="interpolateHSL" class="tsd-anchor"></a><h3>interpolateHSL</h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"><li class="tsd-signature tsd-kind-icon">interpolateHSL<span class="tsd-signature-symbol">(</span>color1<span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a>, color2<span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a>, factor<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/ondras/rot.js/blob/394b3e4/src/color.ts#L104">color.ts:104</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> <p>Interpolate (blend) two colors with a given factor in HSL mode</p> </div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>color1: <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h5></li><li><h5>color2: <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h5></li><li><h5>factor: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 0.5</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"><a id="lerp" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagConst">Const</span> lerp</h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"><li class="tsd-signature tsd-kind-icon">lerp<span class="tsd-signature-symbol">(</span>color1<span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a>, color2<span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a>, factor<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/ondras/rot.js/blob/394b3e4/src/color.ts#L99">color.ts:99</a></li></ul></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>color1: <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h5></li><li><h5>color2: <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h5></li><li><h5>factor: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 0.5</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"><a id="lerpHSL" class="tsd-anchor"></a><h3><span class="tsd-flag ts-flagConst">Const</span> lerpHSL</h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"><li class="tsd-signature tsd-kind-icon">lerpHSL<span class="tsd-signature-symbol">(</span>color1<span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a>, color2<span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a>, factor<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/ondras/rot.js/blob/394b3e4/src/color.ts#L112">color.ts:112</a></li></ul></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>color1: <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h5></li><li><h5>color2: <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h5></li><li><h5>factor: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 0.5</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"><a id="multiply" class="tsd-anchor"></a><h3>multiply</h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"><li class="tsd-signature tsd-kind-icon">multiply<span class="tsd-signature-symbol">(</span>color1<span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a>, <span class="tsd-signature-symbol">...</span>colors<span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/ondras/rot.js/blob/394b3e4/src/color.ts#L65">color.ts:65</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> <p>Multiply (mix) two or more colors</p> </div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>color1: <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h5></li><li><h5><span class="tsd-flag ts-flagRest">Rest</span> <span class="tsd-signature-symbol">...</span>colors: <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"><a id="multiply_" class="tsd-anchor"></a><h3>multiply_</h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"><li class="tsd-signature tsd-kind-icon">multiply_<span class="tsd-signature-symbol">(</span>color1<span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a>, <span class="tsd-signature-symbol">...</span>colors<span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/ondras/rot.js/blob/394b3e4/src/color.ts#L79">color.ts:79</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> <p>Multiply (mix) two or more colors, MODIFIES FIRST ARGUMENT</p> </div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>color1: <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h5></li><li><h5><span class="tsd-flag ts-flagRest">Rest</span> <span class="tsd-signature-symbol">...</span>colors: <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a><span class="tsd-signature-symbol">[]</span></h5></li></ul><h4 class="tsd-returns-title">Returns <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"><a id="randomize" class="tsd-anchor"></a><h3>randomize</h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"><li class="tsd-signature tsd-kind-icon">randomize<span class="tsd-signature-symbol">(</span>color<span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a>, diff<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/ondras/rot.js/blob/394b3e4/src/color.ts#L119">color.ts:119</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> <p>Create a new random color based on this one</p> </div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>color: <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h5></li><li><h5>diff: <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h5><div class="tsd-comment tsd-typography"><div class="lead"> <p>Set of standard deviations</p> </div></div></li></ul><h4 class="tsd-returns-title">Returns <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"><a id="rgb2hsl" class="tsd-anchor"></a><h3>rgb2hsl</h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"><li class="tsd-signature tsd-kind-icon">rgb2hsl<span class="tsd-signature-symbol">(</span>color<span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/ondras/rot.js/blob/394b3e4/src/color.ts#L131">color.ts:131</a></li></ul></aside><div class="tsd-comment tsd-typography"><div class="lead"> <p>Converts an RGB color value to HSL. Expects 0..255 inputs, produces 0..1 outputs.</p> </div></div><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>color: <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h5></li></ul><h4 class="tsd-returns-title">Returns <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"><a id="toHex" class="tsd-anchor"></a><h3>to<wbr/>Hex</h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"><li class="tsd-signature tsd-kind-icon">to<wbr/>Hex<span class="tsd-signature-symbol">(</span>color<span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/ondras/rot.js/blob/394b3e4/src/color.ts#L189">color.ts:189</a></li></ul></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>color: <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4></li></ul></section><section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module"><a id="toRGB" class="tsd-anchor"></a><h3>toRGB</h3><ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module"><li class="tsd-signature tsd-kind-icon">toRGB<span class="tsd-signature-symbol">(</span>color<span class="tsd-signature-symbol">: </span><a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li></ul><ul class="tsd-descriptions"><li class="tsd-description"><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/ondras/rot.js/blob/394b3e4/src/color.ts#L184">color.ts:184</a></li></ul></aside><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameters"><li><h5>color: <a href="color.html#Color" class="tsd-signature-type" data-tsd-kind="Type alias">Color</a></h5></li></ul><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4></li></ul></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class=""><a href="../index.html">Modules</a></li><li class=" tsd-kind-module"><a href="MinHeap.html">Min<wbr/>Heap</a></li><li class="current tsd-kind-module"><a href="color.html">color</a></li><li class=" tsd-kind-module"><a href="constants.html">constants</a></li><li class=" tsd-kind-module"><a href="display_backend.html">display/backend</a></li><li class=" tsd-kind-module"><a href="display_canvas.html">display/canvas</a></li><li class=" tsd-kind-module"><a href="display_display.html">display/display</a></li><li class=" tsd-kind-module"><a href="display_hex.html">display/hex</a></li><li class=" tsd-kind-module"><a href="display_rect.html">display/rect</a></li><li class=" tsd-kind-module"><a href="display_term.html">display/term</a></li><li class=" tsd-kind-module"><a href="display_tile.html">display/tile</a></li><li class=" tsd-kind-module"><a href="display_tile_gl.html">display/tile-<wbr/>gl</a></li><li class=" tsd-kind-module"><a href="display_types.html">display/types</a></li><li class=" tsd-kind-module"><a href="engine.html">engine</a></li><li class=" tsd-kind-module"><a href="eventqueue.html">eventqueue</a></li><li class=" tsd-kind-module"><a href="fov.html">fov</a></li><li class=" tsd-kind-module"><a href="fov_discrete_shadowcasting.html">fov/discrete-<wbr/>shadowcasting</a></li><li class=" tsd-kind-module"><a href="fov_fov.html">fov/fov</a></li><li class=" tsd-kind-module"><a href="fov_precise_shadowcasting.html">fov/precise-<wbr/>shadowcasting</a></li><li class=" tsd-kind-module"><a href="fov_recursive_shadowcasting.html">fov/recursive-<wbr/>shadowcasting</a></li><li class=" tsd-kind-module"><a href="index.html">index</a></li><li class=" tsd-kind-module"><a href="lighting.html">lighting</a></li><li class=" tsd-kind-module"><a href="map.html">map</a></li><li class=" tsd-kind-module"><a href="map_arena.html">map/arena</a></li><li class=" tsd-kind-module"><a href="map_cellular.html">map/cellular</a></li><li class=" tsd-kind-module"><a href="map_digger.html">map/digger</a></li><li class=" tsd-kind-module"><a href="map_dividedmaze.html">map/dividedmaze</a></li><li class=" tsd-kind-module"><a href="map_dungeon.html">map/dungeon</a></li><li class=" tsd-kind-module"><a href="map_ellermaze.html">map/ellermaze</a></li><li class=" tsd-kind-module"><a href="map_features.html">map/features</a></li><li class=" tsd-kind-module"><a href="map_iceymaze.html">map/iceymaze</a></li><li class=" tsd-kind-module"><a href="map_map.html">map/map</a></li><li class=" tsd-kind-module"><a href="map_rogue.html">map/rogue</a></li><li class=" tsd-kind-module"><a href="map_uniform.html">map/uniform</a></li><li class=" tsd-kind-module"><a href="noise.html">noise</a></li><li class=" tsd-kind-module"><a href="noise_noise.html">noise/noise</a></li><li class=" tsd-kind-module"><a href="noise_simplex.html">noise/simplex</a></li><li class=" tsd-kind-module"><a href="path.html">path</a></li><li class=" tsd-kind-module"><a href="path_astar.html">path/astar</a></li><li class=" tsd-kind-module"><a href="path_dijkstra.html">path/dijkstra</a></li><li class=" tsd-kind-module"><a href="path_path.html">path/path</a></li><li class=" tsd-kind-module"><a href="rng.html">rng</a></li><li class=" tsd-kind-module"><a href="scheduler.html">scheduler</a></li><li class=" tsd-kind-module"><a href="scheduler_action.html">scheduler/action</a></li><li class=" tsd-kind-module"><a href="scheduler_scheduler.html">scheduler/scheduler</a></li><li class=" tsd-kind-module"><a href="scheduler_simple.html">scheduler/simple</a></li><li class=" tsd-kind-module"><a href="scheduler_speed.html">scheduler/speed</a></li><li class=" tsd-kind-module"><a href="stringgenerator.html">stringgenerator</a></li><li class=" tsd-kind-module"><a href="text.html">text</a></li><li class=" tsd-kind-module"><a href="util.html">util</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="tsd-kind-type-alias tsd-parent-kind-module"><a href="color.html#Color" class="tsd-kind-icon">Color</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#add" class="tsd-kind-icon">add</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#add_" class="tsd-kind-icon">add_</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#fromString" class="tsd-kind-icon">from<wbr/>String</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#hsl2rgb" class="tsd-kind-icon">hsl2rgb</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#interpolate" class="tsd-kind-icon">interpolate</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#interpolateHSL" class="tsd-kind-icon">interpolateHSL</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#lerp" class="tsd-kind-icon">lerp</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#lerpHSL" class="tsd-kind-icon">lerpHSL</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#multiply" class="tsd-kind-icon">multiply</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#multiply_" class="tsd-kind-icon">multiply_</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#randomize" class="tsd-kind-icon">randomize</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#rgb2hsl" class="tsd-kind-icon">rgb2hsl</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#toHex" class="tsd-kind-icon">to<wbr/>Hex</a></li><li class="tsd-kind-function tsd-parent-kind-module"><a href="color.html#toRGB" class="tsd-kind-icon">toRGB</a></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li><li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li><li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li><li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li><li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="../assets/main.js"></script></body></html>