Skip to content

feat(appearance): add IDE Font Weight setting - #10936

Open
chan1103 wants to merge 2 commits into
stablyai:mainfrom
chan1103:feat/app-font-weight-setting
Open

chan1103 wants to merge 2 commits into
stablyai:mainfrom
chan1103:feat/app-font-weight-setting

Conversation

@chan1103

Copy link
Copy Markdown

Summary

Adds an IDE Font Weight setting under Settings → Appearance → Interface, directly below IDE Font, so users can lighten or strengthen the base weight of interface text.

  • New optional appFontWeight setting (default 400), clamped to the CSS font-weight range 100–900 by a shared normalizer (src/shared/app-fonts.ts, mirroring terminal-fonts.ts).
  • Applied as a --app-font-weight CSS variable from the same effect that owns --app-font-family, in both the main window (App.tsx) and the dashboard pop-out (popout.tsx); consumed by the body base style in main.css.
  • Elements with explicit weights (headings, font-medium/font-semibold UI) keep their hierarchy — only default-weight text follows the setting.
  • The bundled Geist is a variable font (100–900), so every step renders a true weight; custom IDE fonts resolve through normal CSS weight matching.
  • Old profiles backfill to 400 via the persisted-settings defaults, so the UI is unchanged until a user opts in.

Screenshots

Default (400) Lighter (300) Heavier (700)
weight 400 weight 300 weight 700

Testing

  • pnpm lint — every gate passes with this diff except verify:localization-coverage, which fails identically on unchanged current main in my environment (pre-existing "Ghostty" keyword findings in terminal-advanced-platform-search.ts / terminal-pane-appearance-search.ts, files untouched by this PR)
  • pnpm typecheck
  • pnpm test — 37,522 passed; the only 4 failures (GPU-flag, git-prompt, and socket-timing suites) reproduce identically on clean main in this environment and are unrelated to this change
  • pnpm build
  • Added or updated high-quality tests: normalization unit tests (src/shared/app-fonts.test.ts), AppearancePane commit + clamp component tests, and persistence default-backfill/update-merge coverage

AI Review Report

Implemented and reviewed with an AI coding agent. The review explicitly checked:

  • Cross-platform (macOS/Linux/Windows): no platform branches, shortcuts, shortcut labels, paths, shell behavior, or Electron platform differences are touched — the change is a numeric setting plus a CSS variable, identical on all three platforms.
  • Local/SSH/remote: renderer presentation state only; no host, process, or filesystem assumption. The pop-out window applies the same variable so both windows stay consistent.
  • Lifecycle: live-applies through the existing settings→effect path. Verified in a live dev run: committing 300/700 updates getComputedStyle(document.body).fontWeight immediately, and an accidental 400300 entry clamps to 900.
  • Compatibility: appFontWeight is optional in GlobalSettings, so existing fixtures and persisted profiles need no migration; missing values normalize to 400 at every read site (settings UI, main window, pop-out).
  • i18n: label, description, and search-keyword strings added for en/es/ja/ko/zh; verify:localization-catalog passes.

Security Audit

  • No command execution, filesystem path handling, auth, secrets, dependency, or IPC-surface changes.
  • The existing settings channel carries one additional optional numeric field, clamped at every consumer before use; the CSS variable receives a stringified clamped number, so no injection surface.

Notes

  • Visual change is limited to default-weight interface text; no layout shifts observed at 300/400/700 in the live run.
  • No platform-specific, remote-specific, agent-specific, or git-provider-specific behavior.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6b5fa51b-d1ec-4941-92bc-af99bae4701f

📥 Commits

Reviewing files that changed from the base of the PR and between a7d6d38 and 18cf27e.

📒 Files selected for processing (2)
  • src/main/persistence.test.ts
  • src/renderer/src/components/settings/AppearanceInterfaceSection.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/renderer/src/components/settings/AppearanceInterfaceSection.tsx
  • src/main/persistence.test.ts

📝 Walkthrough

Walkthrough

Adds an optional appFontWeight setting with a default of 400 and shared normalization that rounds and clamps values to 100–900. Adds an IDE Font Weight control with localized search metadata and tests for persistence and clamping. Applies the normalized value to the main and pop-out renderers through the --app-font-weight CSS variable and global body styles.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding an IDE Font Weight setting.
Description check ✅ Passed The description matches the template well, covering summary, screenshots, testing, AI review, security audit, and notes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/main/persistence.test.ts (1)

683-683: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Add an existing-profile backfill regression case.

This assertion covers a new profile only. Add a fixture for an existing settings file that omits appFontWeight and assert that loading it produces 400, locking in the legacy-profile compatibility requirement.

src/renderer/src/components/settings/AppearanceInterfaceSection.tsx (1)

207-228: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Derive the suffix from the imported bounds instead of hardcoding.

APP_FONT_WEIGHT_MIN/APP_FONT_WEIGHT_MAX are already imported and used for min/max, but suffix="100-900" is a separate literal. If the bounds ever change, this label silently goes stale.

♻️ Proposed fix
-          suffix="100-900"
+          suffix={`${APP_FONT_WEIGHT_MIN}-${APP_FONT_WEIGHT_MAX}`}

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 483389dd-e0b1-4303-b411-6545a080993a

📥 Commits

Reviewing files that changed from the base of the PR and between 94009f6 and a7d6d38.

📒 Files selected for processing (17)
  • src/main/persistence.test.ts
  • src/renderer/src/App.tsx
  • src/renderer/src/assets/main.css
  • src/renderer/src/components/settings/AppearanceInterfaceSection.tsx
  • src/renderer/src/components/settings/AppearancePane.test.tsx
  • src/renderer/src/components/settings/appearance-search.ts
  • src/renderer/src/components/settings/setting-labels.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/popout.tsx
  • src/shared/app-fonts.test.ts
  • src/shared/app-fonts.ts
  • src/shared/constants.ts
  • src/shared/types.ts

This branch has not been deployed

No deployments
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