{"id":7100,"library":"colourmap","title":"Colourmap","description":"The `colourmap` Python package, currently at version 1.2.1, generates N unique colors from a specified input colormap or list of colors. It also provides utilities for converting between RGB and HEX color formats and can create linear gradients. The package appears to have a moderate release cadence, with recent updates in late 2025.","status":"active","version":"1.2.1","language":"en","source_language":"en","source_url":"https://pypi.org/project/colourmap/","tags":["colors","colormap","unique colors","hex","rgb","color conversion"],"install":[{"cmd":"pip install colourmap","lang":"bash","label":"Latest stable version"}],"dependencies":[],"imports":[{"note":"The package name and the main function/class are both 'colourmap' (with 'u').","symbol":"colourmap","correct":"from colourmap import colourmap"}],"quickstart":{"code":"from colourmap import colourmap\n\n# Generate 5 unique colors from a default colormap\ncolors_hex = colourmap.generate_unique_colors(n_colors=5)\nprint(f\"Generated HEX colors: {colors_hex}\")\n\n# Generate 3 unique colors from a specified list of input colors (e.g., using a seaborn palette)\n# For demonstration, we'll use a simple list; in a real scenario, this might come from seaborn.color_palette\ninput_palette = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b']\ncolors_from_palette_hex = colourmap.generate_unique_colors(input_colors=input_palette, n_colors=3)\nprint(f\"Generated HEX colors from palette: {colors_from_palette_hex}\")\n\n# Convert RGB to HEX\nrgb_color = (255, 0, 0)\nhex_color = colourmap.rgb_to_hex(rgb_color)\nprint(f\"RGB {rgb_color} to HEX: {hex_color}\")\n\n# Convert HEX to RGB\nhex_color_input = '#00FF00'\nrgb_color_output = colourmap.hex_to_rgb(hex_color_input)\nprint(f\"HEX {hex_color_input} to RGB: {rgb_color_output}\")","lang":"python","description":"This quickstart demonstrates how to generate unique colors using the `colourmap` function from a default colormap or a provided list of colors. It also shows the utility functions for converting between RGB and HEX color formats. The core functionality is `generate_unique_colors` which can take an `n_colors` parameter or an `input_colors` list."},"warnings":[{"fix":"Verify your `pip install` command and `from ... import ...` statements. The correct installation is `pip install colourmap` and the main import is `from colourmap import colourmap`.","message":"There are multiple Python packages with similar names ('colormap', 'cmap', 'colormaps'). Ensure you are installing and importing 'colourmap' (with 'u') if you intend to use this specific library.","severity":"gotcha","affected_versions":"All"},{"fix":"Always pass either `n_colors` OR `input_colors`, but not both, to `generate_unique_colors` for clarity and predictable results. Consult the official documentation for specific argument priority if both are present.","message":"The `generate_unique_colors` function can take either `n_colors` (to generate from an internal colormap) or `input_colors` (to sample from a provided list). Using both might lead to unexpected behavior or an error depending on the implementation details for argument precedence.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Change your import statement to `from colourmap import colourmap`.","cause":"Attempted to import 'colormap' (without 'u') when the installed package is 'colourmap' (with 'u').","error":"ModuleNotFoundError: No module named 'colormap'"},{"fix":"If you want to use a specific colormap (e.g., from matplotlib or seaborn), first generate a list of colors from that colormap using its respective library, and then pass that list to `colourmap.generate_unique_colors` via the `input_colors` parameter.","cause":"You are trying to specify a colormap by name directly with a 'cmap_name' argument, which is not supported by this library's `generate_unique_colors` function. It implicitly uses an internal colormap or expects `input_colors`.","error":"TypeError: generate_unique_colors() got an unexpected keyword argument 'cmap_name'"}]}