Skip to content

Feat: Custom Theme Support - #5692

Open
Carlosyoot wants to merge 8 commits into
usebruno:mainfrom
Carlosyoot:feat/custom-theme
Open

Carlosyoot wants to merge 8 commits into
usebruno:mainfrom
Carlosyoot:feat/custom-theme

Conversation

@Carlosyoot

Copy link
Copy Markdown

Feat: Custom Theme Support with Validation & Syntax Colors

Description

This Pull Request introduces Custom Theme Support to Bruno, adding theme validation, syntax color improvements, and enhanced CodeMirror integration.
The goal is to give users greater flexibility in personalizing their UI while ensuring all custom themes follow a safe and predictable structure.


Main Changes

Theme Preferences UI

  • Added live refresh after adding or deleting a custom theme for immediate visual feedback.
  • Improved the delete button with better feedback and error handling.
  • Simplified the display logic for System / Light / Dark / Custom themes.

Theme Provider

  • Implemented validateThemeShape() to validate custom theme objects before applying them.
  • Added descriptive validation errors for missing or invalid keys to prevent broken or incomplete themes.
  • Enhanced theme switching logic between built-in and custom themes for smoother transitions.

Light & Dark Themes

  • Restored the original Light palette to preserve the familiar default look.
  • Introduced new codemirror.syntax colors to both Light and Dark themes:
    • property, string, number, boolean
    • Colors selected for consistency with Monokai-style syntax highlighting.
  • Improved matching-bracket highlighting for better readability in code editors.

CodeMirror Styling

  • Both CodeEditor and QueryEditor now consume syntax colors directly from the active theme.
  • Added a fallback mechanism so that legacy hard-coded colors remain functional with incomplete custom themes.
  • Reduced the risk of visual regressions in existing setups.

Validation Utility

  • Added a new helper: utils/validateThemes/validateThemeShape.js
    • Ensures that imported custom themes follow the required structure.
    • Provides user-friendly validation errors to highlight missing or invalid keys.

Screenshots / Demos

Before / After importing a custom theme:

Before After importing JSON
Before After

Result after applying the custom theme:

Result
image

Example Custom Theme JSON

You can preview the theme structure below or download it directly:

📄 Download themeCustom.json

{
  "name": "RememberPostman",
  "brand": "#546de5",
  "text": "rgb(52, 52, 52)",
  "textLink": "#1663bb",
  "bg": "#fff",
  "codemirror": {
    "bg": "#fff",
    "border": "#efefef",
    "syntax": {
      "property": "#d83e18ff",
      "string": "#2c67d4ff",
      "number": "#0d7527ff",
      "boolean": "#0849aaff"
    }
  }
}

…fresh

- Added automatic refresh after adding or deleting a theme
- Improved delete button behavior and validation
- Simplified display logic for custom themes
- Integrated validateThemeShape() before applying custom themes
- Added refreshThemeList() to update UI after add/delete
- Improved theme switching between system, light, dark, and custom
- Reverted to original light theme palette
- Added new codemirror.syntax block with hardcoded default colors
- Documented new fields for maintainability
- Introduced codemirror.syntax block with property/string/number/boolean colors
- Matched Monokai defaults for consistent dark theme appearance
- Added recursive validation to ensure custom themes follow base structure
- Returns descriptive error messages for missing or invalid keys
- Prevents app crashes when applying incomplete themes
…acket

- Applied property/string/number/boolean colors dynamically
- Added fallback for legacy hardcoded colors
- Improved matching bracket highlight style
…acket

- Applied property/string/number/boolean colors dynamically
- Added fallback for legacy hardcoded colors
- Improved matching bracket highlight style in both CodeEditor and QueryEditor

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant