Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@yvan
Created November 7, 2017 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yvan/d4ffb92d520f93adfd1d548747cdf0ac to your computer and use it in GitHub Desktop.
Save yvan/d4ffb92d520f93adfd1d548747cdf0ac to your computer and use it in GitHub Desktop.
lightblue = [0,191,255]
blue = [65,105,225]
green = [34,139,34]
darkgreen = [0,100,0]
sandy = [210,180,140]
beach = [238, 214, 175]
snow = [255, 250, 250]
mountain = [139, 137, 137]
threshold = 0
def add_color2(world):
color_world = np.zeros(world.shape+(3,))
for i in range(shape[0]):
for j in range(shape[1]):
if world[i][j] < threshold + 0.05:
color_world[i][j] = blue
elif world[i][j] < threshold + 0.055:
color_world[i][j] = sandy
elif world[i][j] < threshold + 0.1:
color_world[i][j] = beach
elif world[i][j] < threshold + 0.25:
color_world[i][j] = green
elif world[i][j] < threshold + 0.6:
color_world[i][j] = darkgreen
elif world[i][j] < threshold + 0.7:
color_world[i][j] = mountain
elif world[i][j] < threshold + 1.0:
color_world[i][j] = snow
return color_world
island_world_grad = add_color2(world_noise)
toimage(island_world_grad).show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment