Skip to content

Support random color scheme selection#20114

Open
RAGHAV-0202 wants to merge 1 commit intomicrosoft:mainfrom
RAGHAV-0202:feature/random-color-scheme
Open

Support random color scheme selection#20114
RAGHAV-0202 wants to merge 1 commit intomicrosoft:mainfrom
RAGHAV-0202:feature/random-color-scheme

Conversation

@RAGHAV-0202
Copy link
Copy Markdown

Summary

Closes #9422

Introduces a special _random keyword for the colorScheme setting. When colorScheme is set to "_random" in settings.json, a randomly chosen color scheme from the available schemes is applied each time a new tab or pane is created.

This is inspired by Oh-My-Zsh's random theme feature, as suggested in the original issue.

Usage

In settings.json, set:

"colorScheme": "_random"

Each new tab will now open with a randomly selected color scheme.

Changes

CascadiaSettings.cpp

  • Added RandomSchemeToken constant (L"_random")
  • Modified _validateAllSchemesExist() to skip validation when the scheme name is _random, preventing the UnknownColorScheme warning that blocked the previous attempt at this feature

TerminalSettings.cpp

  • Modified _ApplyAppearanceSettings() to detect the _random token and resolve it to a randomly selected scheme from the available color schemes map
  • Uses std::random_device + std::mt19937 for proper random selection

Design Decisions

  • Used _random (with underscore prefix) as the token per @zadjii-msft's suggestion that it should be "something slightly more obscure than just random"
  • Random selection happens per-tab (each new tab gets a freshly random scheme), matching the issue's request
  • Both dark and light color scheme names support the _random token independently

Testing

  • This is my first contribution to the project. I'm working on macOS and relying on CI for build verification.
  • Manual test: Set "colorScheme": "_random", open multiple tabs, verify each gets a different random scheme and no warnings appear.

Introduce a special "_random" keyword for the colorScheme setting.
When colorScheme is set to "_random" in settings.json, a randomly
chosen color scheme from the available schemes is applied each time
a new tab or pane is created.

Changes:
- CascadiaSettings.cpp: Skip validation for the "_random" token in
  _validateAllSchemesExist() so it doesn't trigger an
  UnknownColorScheme warning.
- TerminalSettings.cpp: Resolve "_random" to a randomly selected
  scheme at runtime in _ApplyAppearanceSettings().

Usage in settings.json:
  "colorScheme": "_random"

Closes microsoft#9422
@microsoft-github-policy-service microsoft-github-policy-service bot added Issue-Task It's a feature request, but it doesn't really need a major design. Area-Settings Issues related to settings and customizability, for console or terminal Product-Terminal The new Windows Terminal. labels Apr 14, 2026
@RAGHAV-0202
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@RAGHAV-0202
Copy link
Copy Markdown
Author

Hi @zadjii-msft, this PR implements the _random color scheme as discussed in #9422 (including skipping validation and resolving a random scheme at runtime).

Would really appreciate your feedback when you get time. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Settings Issues related to settings and customizability, for console or terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support random color scheme, pseudocode [ scheme = rand(settings.schemes) ]

1 participant