Skip to main content
# Colorsnap

Python package for snaping/rounding colors to other colors/palettes.

Colorsnap comes with predefined palettes for CSS 2-4 and can also take custom ones defined by you as input and then snap/round a specified color to the closes one in the given palette.

## Installing

```python
pip install colorsnap
```

# Usage Examples

```python
import colorsnap

'''
Available palettes:
- CSS_2
- CSS_2_1
- CSS_3
- CSS_4
'''

colorsnap.snap_color(colorsnap.palettes.CSS_3, '#0000ba')
# >>> ('#0000ba', 'mediumblue')

# Using a custom palette
palette = {
'black': '#000000',
'gray': '#808080',
'white': '#ffffff',
}

colorsnap.snap_color(palette, '#0000ba')

# Using a custom palette with unnamed colors
palette = ['#4286f4', '#414449']

color_snap.snap_color(palette, '#5588db')
# >>> ('#5588db', '#4286f4')

```

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

colorsnap-1.1.0.tar.gz (3.7 kB view details)

Uploaded Source

File details

Details for the file colorsnap-1.1.0.tar.gz.

File metadata

  • Download URL: colorsnap-1.1.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.6

File hashes

Hashes for colorsnap-1.1.0.tar.gz
Algorithm Hash digest
SHA256 77ad4de95e6bc67a10239a8665a58bdf84815cc83ae6d44a289599d74ec5b29c
MD5 f27780efbefa79b1d91b860a1e11c0d8
BLAKE2b-256 11ff2b4bb990bbb1bbe022fc756ed0676c4975b7113f6319324a52f9695a013c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.1.0 This release

1 file

1.0.1

1 file

1.0.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page