Skip to content

feat(shot): report the device's brightness and text scale with --brightness and --text-scale - #51

Merged
koji-1009 merged 2 commits into
feat/safe-areafrom
feat/brightness-text-scale
Nov 5, 2026
Merged

koji-1009 merged 2 commits into
feat/safe-areafrom
feat/brightness-text-scale

Conversation

@koji-1009

Copy link
Copy Markdown
Owner

Stacked on #50.

flutter test reports a light platform brightness and a text scale of 1. A preview can set its own through @Preview(brightness:, textScaleFactor:), but a --widget shot has no Preview to set them, so a widget shot without a preview file could not be checked in dark mode or with larger text, and a preview file without them had to be edited to be shot that way.

How it works

  • shutter shot --brightness dark and --text-scale <scale> (and semantics) report that brightness and text scale, as the device's settings; from Dart, shot(brightness: ShotBrightness.dark, textScale: 1.3). The defaults stay light and 1.
  • The harness sets platformBrightnessTestValue and textScaleFactorTestValue from the preview's own brightness / textScaleFactor, else from the run's, so a preview made for light stays light under --brightness dark.
  • shoot rejects a text scale that is not > 0 and finite with exit 64; the CLI rejects one that is not a number, and any brightness but light or dark.
  • The run records brightness: dark and text_scale in manifest.json when not the default, shot prints them, and diff prints both runs' when they differ and returns them as ShotSetup.brightness and ShotSetup.textScale. They are not part of shot ids. ShotBrightness is exported.

Tests

  • test/e2e/device_test.dart: a preview without its own settings reads MediaQuery.platformBrightnessOf as dark and textScalerOf(context).scale(10) as 13 under --brightness dark --text-scale 1.3, and neither without them; a preview with brightness: Brightness.light, textScaleFactor: 1 keeps them, so diff reports it unchanged and prints brightness and text_scale.

Docs

  • doc/manual.md gains a Brightness and text scale section; the drawing model, runs, output, and commands name the options. doc/agent.md, the README, and the CHANGELOG cover them.

🤖 Generated with Claude Code

…htness and --text-scale

shot --brightness dark and --text-scale <scale> (and semantics, and
shot(brightness:, textScale:)) report that platform brightness and text
scale, as a device's settings, to every preview that sets none of its
own; a preview's brightness or textScaleFactor wins. A --widget shot,
which has no Preview to set them, is shot dark or with larger text this
way. The run records brightness and text_scale when not the default,
shot prints them, and diff prints both runs' when they differ and
returns them as ShotSetup.brightness and ShotSetup.textScale; they are
not part of shot ids.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@koji-1009

koji-1009 commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner Author

example/'s SettingsPage preview (390x844, no brightness or textScaleFactor of its own), shown at its logical width: --brightness dark --text-scale 1.3 picks the shell's dark theme and lays the text out larger, as the device's settings would.

default --brightness dark --text-scale 1.3
SettingsPage by default SettingsPage with --brightness dark --text-scale 1.3

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

flutter test multiplies every font size by the text scale, as iOS does,
while Android 14 and later convert each size through the system's own
font scaling, so an Android shot at a scale other than 1 can differ in
size from the device. A dark shot also needs a shell that sets the
app's darkTheme; the default shell sets none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@koji-1009
koji-1009 marked this pull request as ready for review November 4, 2026 23:55
@koji-1009
koji-1009 added this pull request to stack #54 November 5, 2026 00:34
@koji-1009
koji-1009 merged commit b695199 into main Nov 5, 2026
5 checks passed
@koji-1009
koji-1009 deleted the feat/brightness-text-scale branch November 5, 2026 00:55
@koji-1009 koji-1009 mentioned this pull request Nov 5, 2026
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.

2 participants