Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abbe98/colorsnap
Python package for snapping/rounding colors to other colors/palettes.
https://github.com/abbe98/colorsnap
colors owner-idi
Last synced: 4 days ago
JSON representation
Python package for snapping/rounding colors to other colors/palettes.
- Host: GitHub
- URL: https://github.com/abbe98/colorsnap
- Owner: Abbe98
- License: mit
- Created: 2018-08-02T11:37:27.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-09-09T16:55:26.000Z (over 6 years ago)
- Last Synced: 2024-12-12T20:46:11.270Z (10 days ago)
- Topics: colors, owner-idi
- Language: Python
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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')```