Repository navigation
fix(text-style): apply --font-size, --color, --align, --x, --y without a preset - #166
Merged
renezander030 merged 2 commits intoNov 2, 2026
Conversation
…t a preset text-style declared these flags (shared with add-text) but only honoured them through --preset; without one they were silently dropped and the command still exited 0 with "applied": ["shadow", "border"]. setTextStyle now writes font size and colour to the material and to every content style block (CapCut renders from those), plus alignment, and cmdTextStyle moves the segment for --x/--y the way restyle does. --color is validated as #RRGGBB, and compile's text-style op accepts and validates fontSize, alignment and color too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Thanks a lot for the fix and the clear write-up, merged! The one red check is the runner image dropping Python 3.9, unrelated to your change. |
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.
What
text-stylenow applies--font-size,--color,--align,--xand--ywhen no--presetis given.Why
These flags are declared in
text-style's spec (shared withadd-textthroughTEXT_STYLE) and listed bycapcut describe, butcmdTextStyleonly honoured them throughpresetWithFlagOverrides, so only when--presetwas also passed. Without a preset they were dropped silently. The command still exited 0, reporting only the other fields it applied:The text stayed at size 15, stayed white and kept its position. An agent driving the CLI has no signal that anything went wrong.
Changes
setTextStyle(src/decorators.ts) takesfontSize,colorandalignment. Font size and colour go to the material (font_size,text_color) and to every block incontent.styles, because CapCut renders from those blocks. This matches howpresetWithFlagOverridestreats these flags as covering the whole text.--colormust be#RRGGBB, otherwise the command fails before writing.cmdTextStyle(src/index.ts) passes those flags through and moves the segment for--x/--ythe same wayrestyledoes. With--presetthe explicit flags still win, as before.compile(src/compile.ts): thetext-styleoperation'sstylenow validatesfontSize,alignment(finite numbers) andcolor(#RRGGBB), since they now reachsetTextStyle.test/decorators.test.mjs): one test asserts the four fields land in the material, the content style block and the segment transform. Another asserts a non-hex--coloris rejected.CHANGELOG.md: entry under[Unreleased]→Fixed.add-textis unchanged:textStyleOptsFromFlagsstill leaves out these keys, soadd-textkeeps setting them itself.Testing
npm testpassed through the pre-commit hook, on top of v0.32.0 with the editor closed (Windows 11, Node 26): 1353 tests, 1293 pass, 0 fail, 60 skipped."applied":["font_size","color","transform"], andcapcut segmentshows the new size, colour and position in both the material andcontent.styles[0].Note for anyone running the suite on Windows with CapCut open: the editor-open write guard makes 31 tests in
register,rename,sync-timelinesanddiagnose-media-registrationfail. Plainmasterfails the same way, so this branch did not cause it.🤖 Generated with Claude Code