fix: preserve color codes in STL#135
Conversation
|
The last commit should address the issues. Thanks for the review! |
Perfect! ❤️ Could you add some tests too? |
|
As I’ll be skiing for the next 8 days, it may be best to merge/tag without
waiting for me.
But it seems like a good idea and worth a new PR when I return. Also I
have another PR in the works to improve vertical positioning and alignment
when converting TTML to STL, so it would be better to do it from a master
branch which includes the recent PR to avoid gratuitous conflicts, if
possible.
…On Fri 16 Jan 2026 at 10:59, Quentin Renard ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In subtitles.go
<#135 (comment)>:
> @@ -162,6 +162,48 @@ func newColorFromSSAString(s string, base int) (c *Color, err error) {
return
}
+// newColorFromTTMLString builds a new color based on a TTML hex string (e.g., "#ffffff" or "white")
+func newColorFromTTMLString(s string) (*Color, error) {
I really like this idea 👍 However, seeing this, I feel like it would make
even more sense to replace both SRTColor *string and TTMLColor *string
with SRTColor *Color and TTMLColor *Color, that way it would be easier to
manipulate color conversions.
I'd understand if you felt like it would add too much work to this PR. Let
me know whether this is something you feel like doing in this PR 👍
—
Reply to this email directly, view it on GitHub
<#135 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABHMB6G27PJ3HFHTASXEBFD4HCY7BAVCNFSM6AAAAACRK4G4AKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTMNRZHE2TGOBSGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
I don't mind merging the PR as is now however there are conflicts to be resolved in Happy skying! ⛷️ |
2426d5f to
17a9032
Compare
|
Added the color refactoring you suggested. A side effect now that TTMLColor is internally RGB rather than string: if input file was a TTML with named colors, in output TTML file I have to chose to output either named colors or hex colors. I chose hex colors for wider compatibility (in ttml.go:ttmlColorString()). |
Sounds good 👍 I've made a comment with a solution to fix what you've mentioned, but I'd understand if you didn't feel like adding it now in this already complete PR 👍 |
|
Hi, not sure I did what you wanted with Color.HTMLString. |
|
Done, are we there yet ? :) |
Mhahaha we're finally there!! Thanks for sticking with this PR ❤️ Let me know whether you need a tag 👍 |
|
FYI I've created a |
Color information was being lost when converting WebVTT to STL and back.
The stlStyler only handled italics, underline, and boxing but ignored
color control codes (0x00-0x07).
Changes:
This ensures colors are preserved in WebVTT → STL → WebVTT conversions.