Skip to content

feat(docs): add --text-color flag for write, insert, update#412

Open
sixel-et wants to merge 1 commit intosteipete:mainfrom
sixel-et:feat/text-color
Open

feat(docs): add --text-color flag for write, insert, update#412
sixel-et wants to merge 1 commit intosteipete:mainfrom
sixel-et:feat/text-color

Conversation

@sixel-et
Copy link

@sixel-et sixel-et commented Mar 4, 2026

Summary

  • Adds --text-color flag to gog docs write, gog docs insert, and gog docs update commands
  • Accepts named colors (red, blue, green, purple, teal, etc.) and hex colors (#RRGGBB, #RGB)
  • Color is applied via UpdateTextStyleRequest with foregroundColor in the same batch as text insertion
  • Includes ParseTextColor() and BuildColorRequest() exported helpers in docs_formatter.go
  • Unit tests for named color parsing, hex parsing (3-digit, 6-digit, with/without hash), error cases, and request construction

Motivation

When multiple collaborators edit a Google Doc via the CLI, there's no way to visually distinguish who wrote what. This flag lets different users/agents write in different colors, making authorship visible at a glance in the document.

Usage

# Named colors
gog docs write <docId> --text "my note" --text-color blue
gog docs insert <docId> "annotation" --index 42 --text-color red
gog docs update <docId> --text "comment" --text-color purple

# Hex colors
gog docs write <docId> --file notes.txt --append --text-color "#FF6600"
gog docs insert <docId> "highlight" --text-color "#0A0"

Test plan

  • Unit tests for ParseTextColor (named colors, hex, error cases)
  • Unit tests for BuildColorRequest (range, fields, color values)
  • All existing tests pass (go test ./... — 14 packages, 0 failures)
  • Live tested: created Google Doc, wrote black text, appended blue text, inserted dark green hex text — all colors verified via raw API JSON

🤖 Generated with Claude Code

Adds the ability to set foreground text color when writing or inserting
text into Google Docs. Accepts named colors (red, blue, green, etc.) and
hex colors (#RRGGBB, #RGB). The color is applied as an UpdateTextStyleRequest
in the same batch as the text insertion.

Usage:
  gog docs write <docId> --text "hello" --text-color blue
  gog docs insert <docId> "note" --text-color "#FF6600"
  gog docs update <docId> --text "text" --text-color red

Includes ParseTextColor() and BuildColorRequest() helpers, plus unit tests
for named colors, hex parsing, and request construction.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant