Automatic text coloring for 2d graphic designs
Text
elements should have enough contrast with their background. To be recognized as a text, this library uses WCAG standard for color contrast calculation.
poetry add graphic-coloring-engine
from graphic-coloring-engine.core import ColoringEngine
# construct your layout
engine = ColoringEngine(layout, seed, constants)
color_schemes = engine.colorize()
- Collision map is calculated for all elements.
- Collect usable colors for uncolorized elements, which could be from either colorized elements on canvas or external passed in colors.
- For those elements need to be colorized, try colors one by one with minimum contrast constraints with elements it collides. Constraints can be passed from external.
- Output certin amount of color schemes.