Files
colorhash/colorhash/colorizer.py
Alek Ratzloff ca2aa4ca3b Refactor colorizer
Colorizer was a class-based thing but it doesn't really need to be,
because everything is colorized using palettes. If we need to use a
different style of colorization in the future, we will bring the
colorizer class back.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2024-06-03 11:24:31 -07:00

14 lines
342 B
Python

"All things that turn a numeric matrix into a colored matrix."
from typing import Sequence
from .color import Color
from .matricizer import Matrix
from .palettes import Palette
ColorMatrix = Sequence[Sequence[Color]]
def colorize(palette: Palette, matrix: Matrix) -> ColorMatrix:
return [[palette[v] for v in row] for row in matrix]