color_tools.exporters.lospec_exporter

Lospec JSON palette format exporter.

Exports colors in Lospec.com’s JSON palette format for sharing palettes on the Lospec palette list (https://lospec.com/palette-list).

class color_tools.exporters.lospec_exporter.LospecExporter[source]

Bases: PaletteExporter

Lospec JSON palette format exporter.

Exports colors in the JSON format used by Lospec.com palette list. Simple format with palette name, author, and hex color codes.

Format structure:

{
  "name": "Palette Name",
  "author": "Author Name",
  "colors": ["000000", "1d2b53", "7e2553", ...]
}

Example output:

{
  "name": "My Palette",
  "author": "",
  "colors": ["000000", "ff0000", "00ff00"]
}

Hex codes are lowercase without # prefix. Perfect for sharing palettes on https://lospec.com/palette-list

Example

>>> from color_tools.exporters import get_exporter
>>> exporter = get_exporter('lospec')
>>> from color_tools.palette import Palette
>>> palette = Palette.load_default()
>>> path = exporter.export_colors(palette.records[:10], 'palette.json')
property metadata: ExporterMetadata

Return metadata describing this exporter’s capabilities.

Returns:

ExporterMetadata instance with name, description, capabilities