Skip to content

fix: make style/theme names case-insensitive - #562

Open
toller892 wants to merge 1 commit into
charmbracelet:mainfrom
toller892:fix/case-insensitive-theme-names
Open

fix: make style/theme names case-insensitive#562
toller892 wants to merge 1 commit into
charmbracelet:mainfrom
toller892:fix/case-insensitive-theme-names

Conversation

@toller892

Copy link
Copy Markdown

Style names like Dark, DARK, Tokyo-Night now resolve correctly instead of returning style not found. The lookup in getDefaultStyle normalizes the input to lowercase before matching against DefaultStyles.

This means users can now use any casing when specifying built-in themes:

  • WithStandardStyle("Dark") ✅ (previously failed)
  • WithStylePath("TOKYO-NIGHT") ✅ (previously failed)
  • GLAMOUR_STYLE=Dracula ✅ (previously failed)

Fixes #323

Changes

  • glamour.go: Added strings.ToLower() to getDefaultStyle() lookup
  • glamour_test.go: Added TestCaseInsensitiveStyleName and TestCaseInsensitiveStylePath covering various casing patterns (lowercase, uppercase, mixed case, kebab-case variants)

Style names like 'Dark', 'DARK', 'Tokyo-Night' now resolve correctly
instead of returning 'style not found'. The lookup in getDefaultStyle
normalizes the input to lowercase before matching against DefaultStyles.

Fixes charmbracelet#323
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.

theme names are case sensitive

1 participant