@param int $distance

@return Color[]
489828
public function adjacent(int $distance = self::DEFAULT_DISTANCE): array
    {
        return [
            $this->baseColor->adjustHue($distance * -1),
            $this->baseColor,
            $this->baseColor->adjustHue($distance),
        ];
    }
384716
def distance_color_labels(labels):
    '''
    
    '''
    #
    # Color labels so adjacent ones are most distant
    #
    colors = color_labels(labels, True)
    #
    # Order pixels by color, then label #
    #
    rlabels = labels.ravel()
    order = np.lexsort((rlabels, colors.ravel()))
    #
    # Construct color indices with the cumsum trick:
    # cumsum([0,0,1,0,1]) = [0,0,1,1,2]
    # and copy back into the color array, using the order.
    #
    different = np.hstack([[rlabels[order[0]] > 0],
                           rlabels[order[1:]] != rlabels[order[:-1]]])
    # We need to careful about ravel() returning a new object, but in the usual
    # case of colors having order='C', this won't create any copies.
    rcolor = colors.ravel()
    rcolor[order] = np.cumsum(different).astype(colors.dtype)
    return rcolor.reshape(colors.shape).astype(labels.dtype)
79711
def getBoundsColor(self, nNumOutputColors, flCollisionBoundsFadeDistance):
        """"""

        fn = self.function_table.getBoundsColor
        pOutputColorArray = HmdColor_t()
        pOutputCameraColor = HmdColor_t()
        fn(byref(pOutputColorArray), nNumOutputColors, flCollisionBoundsFadeDistance, byref(pOutputCameraColor))
        return pOutputColorArray, pOutputCameraColor
671153
public function findNearest($currentLocation, $distance, $limit = 10)
    {
        $startTimer = microtime(true);

        $res = $this->buildQuery($currentLocation, $distance, $limit);

        $stopTimer = microtime(true);

        return [
            'ids'            => $res->pluck('doc_id'),
            'distances'      => $res->pluck('distance'),
            'hits'           => $res->count(),
            'execution_time' => round($stopTimer - $startTimer, 7) * 1000 ." ms"
        ];
    }
736236
static function resolveColor($color) {
        if(\is_int($color)) {
            return $color;
        }
        
        if(!\is_array($color)) {
            return \hexdec(((string) $color));
        }
        
        if(\count($color) < 1) {
            throw new \InvalidArgumentException('Color "'.\var_export($color, true).'" is not resolvable');
        }
        
        return (($color[0] << 16) + (($color[1] ?? 0) << 8) + ($color[2] ?? 0));
    }
1040595
public function shiftedRight(int $distance) : BigInteger
    {
        if ($distance === 0) {
            return $this;
        }

        if ($distance < 0) {
            return $this->shiftedLeft(- $distance);
        }

        $operand = BigInteger::of(2)->power($distance);

        if ($this->isPositiveOrZero()) {
            return $this->quotient($operand);
        }

        return $this->dividedBy($operand, RoundingMode::UP);
    }
922897
public static function sanitize( $value ) {
		if ( ! is_array( $value ) ) {
			return [];
		}
		foreach ( $value as $key => $val ) {
			$value[ $key ] = Color::sanitize( $val );
		}
		return $value;
	}
102370
function color() {
   var map = {
   "black" : [ 0/255,0/255,0/255 ],
   "silver": [ 192/255,192/255,192/255 ],
   "gray"  : [ 128/255,128/255,128/255 ],
   "white" : [ 255/255,255/255,255/255 ],
   "maroon": [ 128/255,0/255,0/255 ],
   "red"   : [ 255/255,0/255,0/255 ],
   "purple": [ 128/255,0/255,128/255 ],
   "fuchsia": [ 255/255,0/255,255/255 ],
   "green" : [ 0/255,128/255,0/255 ],
   "lime"  : [ 0/255,255/255,0/255 ],
   "olive" : [ 128/255,128/255,0/255 ],
   "yellow": [ 255/255,255/255,0/255 ],
   "navy"  : [ 0/255,0/255,128/255 ],
   "blue"  : [ 0/255,0/255,255/255 ],
   "teal"  : [ 0/255,128/255,128/255 ],
   "aqua"  : [ 0/255,255/255,255/255 ],
   "aliceblue"   : [ 240/255,248/255,255/255 ],
   "antiquewhite"   : [ 250/255,235/255,215/255 ],
   "aqua"  : [ 0/255,255/255,255/255 ],
   "aquamarine"  : [ 127/255,255/255,212/255 ],
   "azure" : [ 240/255,255/255,255/255 ],
   "beige" : [ 245/255,245/255,220/255 ],
   "bisque"   : [ 255/255,228/255,196/255 ],
   "black" : [ 0/255,0/255,0/255 ],
   "blanchedalmond" : [ 255/255,235/255,205/255 ],
   "blue"  : [ 0/255,0/255,255/255 ],
   "blueviolet"  : [ 138/255,43/255,226/255 ],
   "brown" : [ 165/255,42/255,42/255 ],
   "burlywood"   : [ 222/255,184/255,135/255 ],
   "cadetblue"   : [ 95/255,158/255,160/255 ],
   "chartreuse"  : [ 127/255,255/255,0/255 ],
   "chocolate"   : [ 210/255,105/255,30/255 ],
   "coral" : [ 255/255,127/255,80/255 ],
   "cornflowerblue" : [ 100/255,149/255,237/255 ],
   "cornsilk" : [ 255/255,248/255,220/255 ],
   "crimson"  : [ 220/255,20/255,60/255 ],
   "cyan"  : [ 0/255,255/255,255/255 ],
   "darkblue" : [ 0/255,0/255,139/255 ],
   "darkcyan" : [ 0/255,139/255,139/255 ],
   "darkgoldenrod"  : [ 184/255,134/255,11/255 ],
   "darkgray" : [ 169/255,169/255,169/255 ],
   "darkgreen"   : [ 0/255,100/255,0/255 ],
   "darkgrey" : [ 169/255,169/255,169/255 ],
   "darkkhaki"   : [ 189/255,183/255,107/255 ],
   "darkmagenta" : [ 139/255,0/255,139/255 ],
   "darkolivegreen" : [ 85/255,107/255,47/255 ],
   "darkorange"  : [ 255/255,140/255,0/255 ],
   "darkorchid"  : [ 153/255,50/255,204/255 ],
   "darkred"  : [ 139/255,0/255,0/255 ],
   "darksalmon"  : [ 233/255,150/255,122/255 ],
   "darkseagreen"   : [ 143/255,188/255,143/255 ],
   "darkslateblue"  : [ 72/255,61/255,139/255 ],
   "darkslategray"  : [ 47/255,79/255,79/255 ],
   "darkslategrey"  : [ 47/255,79/255,79/255 ],
   "darkturquoise"  : [ 0/255,206/255,209/255 ],
   "darkviolet"  : [ 148/255,0/255,211/255 ],
   "deeppink" : [ 255/255,20/255,147/255 ],
   "deepskyblue" : [ 0/255,191/255,255/255 ],
   "dimgray"  : [ 105/255,105/255,105/255 ],
   "dimgrey"  : [ 105/255,105/255,105/255 ],
   "dodgerblue"  : [ 30/255,144/255,255/255 ],
   "firebrick"   : [ 178/255,34/255,34/255 ],
   "floralwhite" : [ 255/255,250/255,240/255 ],
   "forestgreen" : [ 34/255,139/255,34/255 ],
   "fuchsia"  : [ 255/255,0/255,255/255 ],
   "gainsboro"   : [ 220/255,220/255,220/255 ],
   "ghostwhite"  : [ 248/255,248/255,255/255 ],
   "gold"  : [ 255/255,215/255,0/255 ],
   "goldenrod"   : [ 218/255,165/255,32/255 ],
   "gray"  : [ 128/255,128/255,128/255 ],
   "green" : [ 0/255,128/255,0/255 ],
   "greenyellow" : [ 173/255,255/255,47/255 ],
   "grey"  : [ 128/255,128/255,128/255 ],
   "honeydew" : [ 240/255,255/255,240/255 ],
   "hotpink"  : [ 255/255,105/255,180/255 ],
   "indianred"   : [ 205/255,92/255,92/255 ],
   "indigo"   : [ 75/255,0/255,130/255 ],
   "ivory" : [ 255/255,255/255,240/255 ],
   "khaki" : [ 240/255,230/255,140/255 ],
   "lavender" : [ 230/255,230/255,250/255 ],
   "lavenderblush"  : [ 255/255,240/255,245/255 ],
   "lawngreen"   : [ 124/255,252/255,0/255 ],
   "lemonchiffon"   : [ 255/255,250/255,205/255 ],
   "lightblue"   : [ 173/255,216/255,230/255 ],
   "lightcoral"  : [ 240/255,128/255,128/255 ],
   "lightcyan"   : [ 224/255,255/255,255/255 ],
   "lightgoldenrodyellow" : [ 250/255,250/255,210/255 ],
   "lightgray"   : [ 211/255,211/255,211/255 ],
   "lightgreen"  : [ 144/255,238/255,144/255 ],
   "lightgrey"   : [ 211/255,211/255,211/255 ],
   "lightpink"   : [ 255/255,182/255,193/255 ],
   "lightsalmon" : [ 255/255,160/255,122/255 ],
   "lightseagreen"  : [ 32/255,178/255,170/255 ],
   "lightskyblue"   : [ 135/255,206/255,250/255 ],
   "lightslategray" : [ 119/255,136/255,153/255 ],
   "lightslategrey" : [ 119/255,136/255,153/255 ],
   "lightsteelblue" : [ 176/255,196/255,222/255 ],
   "lightyellow" : [ 255/255,255/255,224/255 ],
   "lime"  : [ 0/255,255/255,0/255 ],
   "limegreen"   : [ 50/255,205/255,50/255 ],
   "linen" : [ 250/255,240/255,230/255 ],
   "magenta"  : [ 255/255,0/255,255/255 ],
   "maroon"   : [ 128/255,0/255,0/255 ],
   "mediumaquamarine"  : [ 102/255,205/255,170/255 ],
   "mediumblue"  : [ 0/255,0/255,205/255 ],
   "mediumorchid"   : [ 186/255,85/255,211/255 ],
   "mediumpurple"   : [ 147/255,112/255,219/255 ],
   "mediumseagreen" : [ 60/255,179/255,113/255 ],
   "mediumslateblue"   : [ 123/255,104/255,238/255 ],
   "mediumspringgreen" : [ 0/255,250/255,154/255 ],
   "mediumturquoise"   : [ 72/255,209/255,204/255 ],
   "mediumvioletred"   : [ 199/255,21/255,133/255 ],
   "midnightblue"   : [ 25/255,25/255,112/255 ],
   "mintcream"   : [ 245/255,255/255,250/255 ],
   "mistyrose"   : [ 255/255,228/255,225/255 ],
   "moccasin" : [ 255/255,228/255,181/255 ],
   "navajowhite" : [ 255/255,222/255,173/255 ],
   "navy"  : [ 0/255,0/255,128/255 ],
   "oldlace"  : [ 253/255,245/255,230/255 ],
   "olive" : [ 128/255,128/255,0/255 ],
   "olivedrab"   : [ 107/255,142/255,35/255 ],
   "orange"   : [ 255/255,165/255,0/255 ],
   "orangered"   : [ 255/255,69/255,0/255 ],
   "orchid"   : [ 218/255,112/255,214/255 ],
   "palegoldenrod"  : [ 238/255,232/255,170/255 ],
   "palegreen"   : [ 152/255,251/255,152/255 ],
   "paleturquoise"  : [ 175/255,238/255,238/255 ],
   "palevioletred"  : [ 219/255,112/255,147/255 ],
   "papayawhip"  : [ 255/255,239/255,213/255 ],
   "peachpuff"   : [ 255/255,218/255,185/255 ],
   "peru"  : [ 205/255,133/255,63/255 ],
   "pink"  : [ 255/255,192/255,203/255 ],
   "plum"  : [ 221/255,160/255,221/255 ],
   "powderblue"  : [ 176/255,224/255,230/255 ],
   "purple"   : [ 128/255,0/255,128/255 ],
   "red"   : [ 255/255,0/255,0/255 ],
   "rosybrown"   : [ 188/255,143/255,143/255 ],
   "royalblue"   : [ 65/255,105/255,225/255 ],
   "saddlebrown" : [ 139/255,69/255,19/255 ],
   "salmon"   : [ 250/255,128/255,114/255 ],
   "sandybrown"  : [ 244/255,164/255,96/255 ],
   "seagreen" : [ 46/255,139/255,87/255 ],
   "seashell" : [ 255/255,245/255,238/255 ],
   "sienna"   : [ 160/255,82/255,45/255 ],
   "silver"   : [ 192/255,192/255,192/255 ],
   "skyblue"  : [ 135/255,206/255,235/255 ],
   "slateblue"   : [ 106/255,90/255,205/255 ],
   "slategray"   : [ 112/255,128/255,144/255 ],
   "slategrey"   : [ 112/255,128/255,144/255 ],
   "snow"  : [ 255/255,250/255,250/255 ],
   "springgreen" : [ 0/255,255/255,127/255 ],
   "steelblue"   : [ 70/255,130/255,180/255 ],
   "tan"   : [ 210/255,180/255,140/255 ],
   "teal"  : [ 0/255,128/255,128/255 ],
   "thistle"  : [ 216/255,191/255,216/255 ],
   "tomato"   : [ 255/255,99/255,71/255 ],
   "turquoise"   : [ 64/255,224/255,208/255 ],
   "violet"   : [ 238/255,130/255,238/255 ],
   "wheat" : [ 245/255,222/255,179/255 ],
   "white" : [ 255/255,255/255,255/255 ],
   "whitesmoke"  : [ 245/255,245/255,245/255 ],
   "yellow"   : [ 255/255,255/255,0/255 ],
   "yellowgreen" : [ 154/255,205/255,50/255 ] };

   var o, i = 1, a = arguments, c = a[0], alpha;

   if(a[0].length<4 && (a[i]*1-0)==a[i]) { alpha = a[i++]; }  // first argument rgb (no a), and next one is numeric?
   if(a[i].length) { a = a[i], i = 0; }                       // next arg an array, make it our main array to walk through
   if(typeof c == 'string')
      c = map[c.toLowerCase()];
   if(alpha!==undefined) 
      c = c.concat(alpha);
   for(o=a[i++]; i<a.length; i++) { 
      o = o.union(a[i]);
   } 
   return o.setColor(c);
}
582398
public function getHexColors($limit = null, $round = true) {

		$hex 	= [];
		$width 	= imagesx($this -> image);
		$height = imagesy($this -> image);
			
		for($y = 0; $y < $height; $y++) {

			for($x = 0; $x < $width; $x++) {

				$index = imagecolorat($this -> image, $x, $y);
				$color = imagecolorsforindex($this -> image, $index);
				
				if(true === $round) {

					foreach(['red', 'green', 'blue'] as $type) {

						$color[$type] = intval((($color[$type]) + 15) / 32) * 32;

						if($color[$type] >= 256){
							$color[$type] = 240;
						}
					}
				}

				$hex[] = substr('0' . dechex($color['red']), -2) . substr('0' . dechex($color['green']), -2) . substr('0' . dechex($color['blue']), -2);
			}
		}

		$hex = array_count_values($hex);

		natsort($hex);

		$hex = $limit ? array_slice(array_reverse($hex, true), 0, $limit, true) : array_reverse($hex, true);

		return $hex;
	}
301345
protected static function rgbToSrgb($rgb)
    {
        return [
            'R' => self::rgbToSrgbStep($rgb['R']),
            'G' => self::rgbToSrgbStep($rgb['G']),
            'B' => self::rgbToSrgbStep($rgb['B']),
        ];
    }
512298
private function colorizeRatios(Collection $ratios)
    {
        $colors = ['#F56954', '#00A65A', '#F39C12', '#00C0EF', '#3C8DBC'];

        return $ratios->values()->transform(function (array $values, $key) use ($colors) {
            return $values + ['color' => $colors[$key]];
        });
    }
480837
public function color($color)
    {
        if ($color instanceof Collection) {
            $color = $color->toArray();
        }

        return $this->options([
            'color' => $color,
        ]);
    }
739314
public function getColorFromRatio( $ratio ){
		if( $this->getOption( 'invertColor' ) )
			$ratio	= 1 - $ratio;
		$colorR	= ( 1 - $ratio ) > 0.5 ? 255 : round( ( 1 - $ratio ) * 2 * 255 );
		$colorG	= $ratio > 0.5 ? 255 : round( $ratio * 2 * 255 );
		$colorB	= "0";
		return array( $colorR, $colorG, $colorB );
	}
1166777
public function triad(int $distance = self::DEFAULT_DISTANCE): array
    {
        return [
            $this->baseColor,
            $this->baseColor->adjustHue(180 - $distance),
            $this->baseColor->adjustHue(180 + $distance),
        ];
    }
573998
public function getRgbByColor($color) {
		$result = imagecolorsforindex($this->image, $color);
		return array(
			$result['red'],
			$result['green'],
			$result['blue']
		);
	}
163265
public static function getRGBColor($id): array
    {
        if (strpos($id, '#') === 0) {
            $hash = substr($id, 1, 6);
        } else {
            $hash = md5($id); // modify 'color' to get a different palette
        }

        return [
            hexdec(substr($hash, 0, 2)), // r
            hexdec(substr($hash, 2, 2)), // g
            hexdec(substr($hash, 4, 2)), // b
        ];
    }
1345606
protected function getRGB($x, $y) {
        $rgb = imagecolorat($this->image, $x, $y);

        return [
            'r' => ($rgb >> 16) & 0xFF,
            'g' => ($rgb >> 8) & 0xFF,
            'b' => $rgb & 0xFF
        ];
    }