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>
14 lines
342 B
Python
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]
|