Skip to content

Expand appearance settings to include font and background customization - #4

Merged
fuerstenberg merged 1 commit into
mainfrom
claude/eager-davinci-2rtuva
Sep 13, 2026
Merged

fuerstenberg merged 1 commit into
mainfrom
claude/eager-davinci-2rtuva

Conversation

@fuerstenberg

Copy link
Copy Markdown
Owner

Summary

Refactored and expanded the appearance customization system to manage not just syntax highlighting colors, but also editor font family, font size, and background color. Renamed ColorSettings to AppearanceSettings to reflect its broader scope.

Key Changes

  • Replaced ColorSettings with AppearanceSettings: The new class manages the complete visual appearance of the editor, including:

    • Syntax highlighting color palette (existing functionality)
    • Editor background color (custom or system default)
    • Font family selection (system monospace or any available font)
    • Font size (9-32pt range, default 13pt)
  • Introduced EditorTheme value type: A new struct that encapsulates all theme properties as a single, equatable value for efficient change detection and comparison. Includes computed properties for:

    • Resolving font based on family and size
    • Determining appropriate text color based on background brightness
    • Accessing background color (custom or system)
  • Added FontCatalog utility: Provides cached lists of available monospaced and all font families to avoid repeated expensive NSFontManager queries.

  • Enhanced SettingsView: Expanded UI to include:

    • Font family picker with toggle to show all fonts vs. monospace only
    • Font size stepper control
    • Background color picker with system/custom toggle
    • Live preview section showing syntax highlighting with current theme
    • Separate reset buttons for colors vs. font/background
  • Updated GherkinTextView and related components:

    • Changed from passing individual palette to passing complete EditorTheme
    • Theme application now handles font, background color, and text color
    • Scroll view appearance automatically adjusts for custom backgrounds
    • Suggestion panel font syncs with editor font
  • Extended NSColor utilities: Added isDark property using Rec. 601 brightness calculation to determine appropriate text color contrast.

  • Updated README: Added documentation about font and background customization features.

Implementation Details

  • Theme changes are detected via EditorTheme equality comparison, triggering rehighlighting only when necessary
  • System background color is resolved at the moment of switching to custom color to preserve current appearance
  • Custom background colors automatically adjust text and UI element colors for readability
  • Font selection gracefully falls back to system monospace if a previously selected font becomes unavailable

https://claude.ai/code/session_01EkV7zVGNsJEj5ex3SV1ejf

The settings window only knew the eight highlight colors. It now also holds the
editor background color and the font family and size, all stored in UserDefaults
and applied to the open document right away.

`ColorSettings` becomes `AppearanceSettings` around a new `EditorTheme` value:
palette, background hex, font family and size in one comparable struct, so the
text view can tell in one check whether it has to redraw.

Two details worth noting: a custom background gets black or white text (and a
matching aqua/darkAqua appearance for the scrollers), because `.textColor`
follows the system appearance and would otherwise turn unreadable; and the
suggest panel draws its rows in the editor font, since that is the text it
inserts.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EkV7zVGNsJEj5ex3SV1ejf
@fuerstenberg
fuerstenberg merged commit 3eda066 into main Sep 13, 2026
1 check passed
@fuerstenberg
fuerstenberg deleted the claude/eager-davinci-2rtuva branch September 13, 2026 20:58
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