Metadata-Version: 2.4
Name: pytomutil-elunico
Version: 0.0.9
Summary: Library for parsing and writing Simple Property List (SPL) files 
Home-page: https://github.com/elunico/pytomutil
Author: Thomas Povinelli
Author-email: tompov227@gmail.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python
Dynamic: summary

# PyTomUtil

A collection of helpful utilties in Python.

Similar to the `tecoradors-elunico` package I have but that is just for useful decorators. This is any useful utility: function or class or other

## PyPI

[https://pypi.org/project/pytomutil-elunico/](https://pypi.org/project/pytomutil-elunico/)

## Content

`frange` class works like `range` but allows floating point values. Requires `start`, `stop`, and `step` to always be specified

```python
class frange:
    def __init__(self, start: float, stop: float, step: float) -> None:
        ...

    def __iter__(self):
        ...

    def __next__(self):
        ...
```

---

`lerp` is a function for linearly interpolating between two values according to a percentage between 0.0 and 1.0.

[Linear Interpolation in Wikipedia](https://en.wikipedia.org/wiki/Linear_interpolation)

```python
def lerp(a: float, b: float, t: float) -> float:
    return (1 - t) * a + t * b
```

---

`SRGBColor` is a class for managing colors in SRGB color space. Works with linear interpolation between colors and `luminance` values. The class accepts r, g, b and optionally an alpha channel in the range 0.0 to 1.0.

```python
class SRGBColor:
    def __init__(self, r: float, g: float, b: float, a: float = 1.0):
        ...

    def lerp(self, other: "SRGBColor", percent: float) -> "SRGBColor":
        ...

    @property
    def luminance(self) -> float:
        """Given an sRGB color as 3 RGB values between 0 and 1, return their relative luminance"""
        ...
```
