MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / get_black_and_white_rgb

Function get_black_and_white_rgb

fractals/mandelbrot.py:50–65  ·  view source on GitHub ↗

Black&white color-coding that ignores the relative distance. The Mandelbrot set is black, everything else is white. >>> get_black_and_white_rgb(0) (255, 255, 255) >>> get_black_and_white_rgb(0.5) (255, 255, 255) >>> get_black_and_white_rgb(1) (0, 0, 0)

(distance: float)

Source from the content-addressed store, hash-verified

48
49
50def get_black_and_white_rgb(distance: float) -> tuple:
51 """
52 Black&white color-coding that ignores the relative distance. The Mandelbrot
53 set is black, everything else is white.
54
55 >>> get_black_and_white_rgb(0)
56 (255, 255, 255)
57 >>> get_black_and_white_rgb(0.5)
58 (255, 255, 255)
59 >>> get_black_and_white_rgb(1)
60 (0, 0, 0)
61 """
62 if distance == 1:
63 return (0, 0, 0)
64 else:
65 return (255, 255, 255)
66
67
68def get_color_coded_rgb(distance: float) -> tuple:

Callers 1

get_imageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected