/album-colours

Generate seaborn plots with artist album colors

Primary LanguageJupyter NotebookMIT LicenseMIT

album_colours

Color your favorite albums into seaborn or matplotlib.

These palettes are the result of employing KMeans clustering on the color data extracted from the album covers.

The album selection for each artist was influenced by the colors of their cover, instead of their quality or representativeness.

Other albums are free to join this package. Open a PR with the album cover and the name of the artist and album.

Inspiration:

Installation

$ pip install album_colours 

Usage

Use this way into your notebook or script:

from album_colours import palette_generator

palette = palette_generator.color_gradient_generator('<palette>', 2)

We currently support the following albums:

Palettes

Some of the palettes look like this:

gradient-kid-a

bad_bunny Un verano sin ti - Bad Bunny

gradient-un-verano-sin-ti

gradient-motomami

alvaro_diaz Felicilandia - Álvaro Díaz

gradient-felicilandia

kanye The life of pablo - Kanye West

gradient-life-of-pablo

kendrick3 Mr. Morale & the Big Steppers - Kendrick Lamar

gradient-mr-morale

radiohead Kid A - Radiohead

Palette creations

The library at its core has the principal colors as a list of hex values. Use the palette_generator.color_gradient_generator() function to build and view your palettes.

Parameters

  • palette - The name of the palette you want to generate. See the list of available above. If the palette is not found, it will return an empty list.
  • color_count - The number of colors you want to generate. Default is the length of elements in the list.
  • palette_type - The type of palette you want to generate. Options are discrete and continuous. Default is discrete.

Its also recommended if you want to have the colors but in different order to use sample() from random package. As it is shown in the examples_plots.ipynb notebook.

Discrete palettes

palette_generator.color_gradient_generator('bad_bunny')

badbunny_10

palette_generator.color_gradient_generator('rosalia', 4)

rosalia_4


Continuous palettes

palette_generator.color_gradient_generator('bad_bunny', 20)

badbunny_20

palette_generator.color_gradient_generator('rosalia', 20)

rosalia_20

Plot examples

The library returns a list of colors that can be used in seaborn or matplotlib plots. Read more about it here: https://seaborn.pydata.org/tutorial/color_palettes.html

All examples are in the example notebook.

# all imports ...
bad_bunny = palette_generator.color_gradient_generator('bad_bunny', 9)

sns.set_palette(bad_bunny)
sns.scatterplot(x="total_bill", y="tip", hue="sex", size="size", sizes=(50, 200), data=tips)

plot-tips-bb


p = palette_generator.color_gradient_generator('aventura', 9)
p_random = random.sample(p, 2)

sns.set_palette(p_random)
sns.relplot(
    data=fmri, kind="line",
    x="timepoint", y="signal", col="region",
    palette=p_random,
    hue="event", style="event",
)

plot_fmri


p = palette_generator.color_gradient_generator('tyler', 9)
p_random = random.sample(p, 2)

sns.set_palette(p_random)
sns.catplot(data=tips, kind="violin", x="day", y="total_bill", hue="smoker", split=True)

plot_tyler


p = palette_generator.color_gradient_generator('alvaro_diaz', 9)
p_random = random.sample(p, 3)

penguins = sns.load_dataset("penguins")
sns.set_palette(p_random)
sns.jointplot(data=penguins, x="flipper_length_mm", y="bill_length_mm", hue="species")

plot_tyler


License

album-colours was created by Majo Castañeda, Dante Bazaldua. It is licensed under the terms of the MIT license.

Contact

For any comments or suggestions, feel free to reach me at dalnte@me.com or @MajoSedCast