Metadata-Version: 2.4
Name: colorvector
Version: 0.0.2
Summary: Easily generates a simple linear color array.
Home-page: https://github.com/Novice052/colorvector-py
Author: John Abbott
Author-email: immersed101@protonmail.com
License: MIT
Project-URL: Bug Tracker, https://github.com/Novice052/colorvector-py/issues
Project-URL: Changelog, https://github.com/Novice052/colorvector-py/blob/master/CHANGELOG.md
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Typing :: Typed
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# Color Vector

A simple utility that given two colors in RGB format and a number of desired intervals, returns an array of colors
evenly distributed between (and including) the two starting colors.

## Installation

```bash
pip install colorvector
```

## How to use it

```python
from colorvector import get_palette

palette = get_palette([0, 0, 0], [255, 255, 255], 3)
print(palette)
# [(0, 0, 0), (128, 128, 128), (255, 255, 255)]
```

Import the `get_palette` function and feed it your starting and ending colors as arrays of three integers (e.g. [0, 0, 0] and [255, 255, 255]) and an integer representing the number of colors you want in the palette (includes the two colors you gave it).

It will return an array of RGB values that fall on the vector between the starting and ending colors that are equidistant from each other (rounded to the nearest integer).

Input rules:
- Colors must have exactly 3 integer values from 0 to 255.
- `n` must be an integer greater than or equal to 2.

So, if you give it: `[0, 0, 0], [255, 255, 255], 3`
It will return: `[(0, 0, 0), (128, 128, 128), (255, 255, 255)]`

### How the math works:

```Point 1:  (1,2,3)    Point 2:  (5, 0, -1).  
To lay out the points from Point 1 to Point 2,
Subtract (5,0,-1) - (1,2,3) to get the direction vector for the line.  In this case, <4, -2, -4>.

Then create the parametric equation for the line <x,y,z> = t * <4, -2, -4> + <1,2,3>

This set up leads to: 
when t = 0, <x,y,z> = 0* <4, -2, -4> + <1,2,3>  = < 1,2,3 >
when t = 1, <x,y,z> = 1* <4, -2, -4> + <1,2,3>  = < 5,0,-1 >

To distribute points evenly along this interval, distribute t evenly at the fractional size you need.  
For example for 6 points between and including both Point 1 and Point 2, divide into 5ths by letting 
t=0, .2, .4, .6, .8, 1.  ```
