Repository navigation
feat(colorize): per-chunk colorization + rename --palette-colors to --colorize - #5
Merged
Merged
Conversation
…o --colorize
Replace the boolean --palette-colors flag with --colorize {global,per-chunk}.
global keeps the whole-video color pair; per-chunk samples a frame at each
caption block's timestamp and applies its own text/box colors via inline ASS
overrides. Factor the color picker into a pure select_colors() and document
the feature in its own README section.
…2 dep caption.py never imported pysubs2, so remove it from dependencies. Add a dev dependency group with pytest and ruff, a light ruff lint config, and 27 subprocess-free unit tests covering color math, contrast, time formatting, chunking, .wts parsing, color selection, and ASS generation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a per-timestamp colorization mode and reworks the colorize flag.
Colorize
The boolean
--palette-colorsflag is replaced by--colorize {global,per-chunk}(no back-compat):--colorize globalkeeps today's behavior: sample frames across the whole video and pick one text/box pair.--colorize per-chunksamples a frame at each caption block's timestamp and applies that block's own text/box colors, so the colors track the imagery on screen as captions advance.Per-chunk colors are applied as inline ASS
\1c/\1aoverrides;globaland off keep using the style header. The color picker is factored into a pureselect_colors()so both modes share the same WCAG AA contrast check and fallback. Color changes between blocks are hard cuts for now; tweening can come later.The README gets a dedicated Colorize section, and AGENTS.md is updated to match.
Cleanup
caption.pynever importedpysubs2, so it's removed from dependencies (the project now has no runtime third-party deps).Tests, lint, CI
select_colors, ASS generation). They run in well under a second.devdependency group.Both modes were verified end-to-end burning a real video with whisper + ffmpeg-full.