Skip to content

Support random color scheme selection#20114

Open
RAGHAV-0202 wants to merge 2 commits intomicrosoft:mainfrom
RAGHAV-0202:feature/random-color-scheme
Open

Support random color scheme selection#20114
RAGHAV-0202 wants to merge 2 commits 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 @DHowett , 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!

@github-actions
Copy link
Copy Markdown

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, 👼 SARIF report, or 📝 job summary for details.

Unrecognized words (780)
aarch
abcd
abcde
ABCDEFG
abcdefghijk
ABCDEFGHIJKLMNOPQRST
ABCDEFGHIJKLMNOPQRSTUVWXY
abcdefghijklmnopqrstuvwxyz
abi
ACL'd
activatable
ACTIVEBORDER
ACTIVECAPTION
addressof
admins
alloc
ALLUSERSPROFILE
amd
antialias
apc
api
APPDATA
APPICON
appid
appium
applet
apps
architected
argb
argc
args
argv
asan
ASDF
asm
attr
autocomplete
autocompletion
autocrlf
autogenerated
AVI
AVX
backend
backport
backpressure
bashrc
baz
bcrypt
bezier
bgcolor
BGR
bitflags
bitmask
bitset
blog
bmp
bookmarking
Bopomofo
BOTTOMLEFT
BOTTOMRIGHT
BRK
bstr
btn
buf
bugfix
bugfixes
byref
bytearray
bytebuffer
cac
callee
calt
cbegin
cbuffer
cci
cctype
CDATA
cdecl
cend
cerr
cfg
CFlags
changelist
changelog
charset
chcp
checkbox
checkboxes
Checkin
chk
chrono
cielab
cjk
CLE
clig
clocale
cls
clsid
cmath
Cmdlet
cmdline
CMOV
cmp
cmt
cmyk
cnt
CNTRL
codebase
codepage
codepath
codepoint
colorref
colorscheme
colorspaces
combobox
COMDAT
commandline
COMMITID
compat
componentization
concat
config
configurability
conint
constexpr
constness
CONTEXTMENU
coord
copymode
cout
cpp
crbegin
cred
cref
crend
crlf
cron
Crt
csharp
csproj
Csr
css
cstdarg
cstddef
cstdio
cstdlib
cstr
cstring
csv
ctime
ctor
ctx
ctype
CUI
curated
cwchar
cwctype
cwd
cxx
cybersecurity
cygwin
cyrl
DATAVIEW
DATAW
dbg
dealloc
debounce
debounced
declspec
decltype
declval
Dedupe
deduplicate
deduplicated
deduplicating
deiconify
delims
deps
deque
deref
deserialization
deserialize
deserialized
deserializer
deserializing
dest
Devops
Dirs
distro
dll
dllexport
dllimport
DLOAD
dns
doc'd
DOCTYPE
downlevel
dpi
dropdown
DROPDOWNLIST
dst
DTest
dtor
dword
editorconfig
elems
elif
elseif
emacs
endian
endif
endl
endlocal
endregion
endswith
ENQ
enqueuing
entrypoint
enum
envvar
eol
ERANGE
errno
errorlevel
ETB
ETX
EVENTID
exe
executables
fabs
failfast
fallthrough
fclose
fenv
fgetc
fgetwc
fileno
filepath
filesystem
FILETYPE
finalizer
FINDSTR
FINDUP
floorf
flyout
FONTFAMILY
fontlist
FONTSIZE
FONTWEIGHT
forceinline
foreach
fprintf
Free'd
freopen
frontend
FSCTL
fstream
ftp
fullscreen
func
fuzzer
GAUSSIAN
gcc
gcy
getch
getchar
GETFONTSIZE
getline
GETPOS
GETSTATE
GETTEXT
getwriter
github
globals
gmail
GNUC
GPUs
grayscale
grep
groupbox
GTR
gui
GURMUKHI
HALFWIDTH
hardcode
hardcoded
hashmap
hashtable
hfile
HIGHLIGHTTEXT
HINSTANCE
hlocal
hls
HMENU
HMONITOR
HOMEDRIVE
HOMEPATH
horiz
HORZ
hostname
HOTFIX
hpp
Hread
HRSRC
HSL
hstring
hsv
html
http
hyperlink
icacls
ico
Iconified
iconify
icu
idx
ifdef
ifndef
ifstream
IGNORECASE
imagemagick
Imatch
img
impl
inheritdoc
ini
inlined
inlines
inlining
inout
inplace
intellisense
Interner
interop
interoperability
INTRINSICS
ioctl
iomanip
iostream
iot
ipconfig
iswdigit
jpeg
jpg
json
jsonc
JUnit
kbd
keybinding
keycode
keydown
keymap
keyscan
keyup
LATN
LBound
LEFTSHIFT
len
LFs
lhs
linkpath
Linq
linux
listbox
listdir
LLVM
lnk
localhost
lorem
lowercased
LPBYTE
LPCOLORREF
LPCSTR
LPCWSTR
LPDWORD
LPINT
LPPOINT
LPRECT
LPVOID
lrint
lrintf
lroundf
lru
lss
ltrim
ltype
Lua
malloc
markdownlint
matrix'd
MAXLENGTH
memcmp
memcpy
memmove
memset
MENUITEM
Mersenne
metadata
mimetype
mingw
minimap
Minimatch
mkdir
MMIX
monospaced
monostate
MOUSEMOVE
mousewheel
Mozilla
msbuild
msdn
msvc
msvcrt
msys
mui
mul
multiline
Munged
mutex
mutexes
nameof
namespace
namespaced
nano
natvis
nbsp
NDEBUG
NEQ
nodiscard
noexcept
NOHELP
noinline
Nop
noreply
noreturn
nothrow
notmatch
NOTNULL
NOUPDATE
novtable
NOWAIT
nowrap
npm
npos
nuget
nullability
nullopt
nullptr
numlock
numpad
nuspec
NVR
oauth
OBJID
oem
offboarded
Ogonek
oklab
OOM
OPENTYPE
ostream
ostringstream
Outof
OUTOFMEMORY
params
passthrough
pathext
PBOOL
PBYTE
PCHAR
pcs
pdb
pdbonly
PDWORD
perl
pgdn
pgup
PHANDLE
pid
pkey
placeholders
PLARGE
plist
plugin
png
popd
POPF
popup
positionals
pragma
prebuilt
precomp
prefilled
prefs
PRELOAD
premultiplied
prepopulated
printf
Productize
proj
psd
pseudoterminal
PSHORT
psm
ptr
ptrdiff
PULONG
punycode
pushd
putchar
putwchar
PVOID
PWCHAR
PWORD
pwsh
qos
queryable
rar
rasterizer
rawinput
rbegin
RCDATA
rcl
rdbuf
readline
readme
readonly
READWRITE
realloc
rects
Recv
refactor
refactoring
refcount
Reference'd
referer
regex
regexes
remoting
renamer
reparent
resizable
retval
rgb
rgba
RGBCOLOR
rhs
RMENU
rng
roadmap
roundtrip
rst
rtf
Rtl
rtrim
RTTI
ruleset
rvalue
safearray
sapi
scancode
screenshot
scrollable
scrollbar
Scroller
sdk
sdl
searchbox
SELECTALL
selectany
serializers
SETCOLOR
setfill
SETFONT
setlocal
setlocale
setmode
SETPOS
SETTITLE
setw
SHRT
sinf
Singleline
sizeof
SND
somefile
spam
SPDX
spec'd
sprintf
srand
src
sre
srgb
Srv
ssh
sstream
standalone
Statusline
stdcall
stderr
stdexcept
stdin
STDIO
stdout
stl
stosw
stoul
strikethrough
Stringable
stringify
stringstream
strlen
strrev
strtok
strtoull
structs
STX
subfolder
subkey
submenu
subspan
substr
sudo
svg
swappable
swprintf
symlink
sync'd
sys
targetnametoken
targetsize
taskbar
tearoff
telnet
telnetd
tempdir
templated
testapp
testenv
texel
textarea
Textbox
threadpool
timeline
titlebar
tmux
todo
tok
tokenizing
toolbar
tooltip
TOPLEFT
toplevel
TOPRIGHT
touchpad
towlower
towupper
transcoder
TREX
trie
truetype
trunc
tsf
ttf
typedef
typeid
typeinfo
typelib
typename
typeof
typeparam
ubuntu
uchar
ucs
UDM
Uid
uint
uintptr
UIs
ULLONG
ulong
umul
umulh
uncomment
undef
Unescape
unfocus
unicode
uninit
Uninitialize
Uninstall
unittest
unpause
unregister
Unregistering
upvote
uri
url
USASCII
USERDATA
USERDOMAIN
username
userprofile
ushort
Utc
utf
utils
uuid
uuidof
Validator
Vals
vcpkg
vcxproj
vec
vectorize
vectorized
versioned
versioning
viewports
virtualization
Virtualizing
VPATH
vsnprintf
vsprintf
vtable
walkthrough
wav
WCAG
wchar
wcout
wcscmp
wcscpy
wcslen
wcsrchr
wcstod
wcstof
wcstoul
website
websocket
WEOF
whitelisting
whitespaces
wifstream
Wiki
Wikipedia
wildcards
WINDOWFRAME
WINDOWTEXT
WINDOWTITLE
winsock
wmemchr
workaround
workflow
wprintf
WSA
wsl
wsmatch
wss
wstring
wstringstream
xaml
xargs
xml
xmlns
xor
XPosition
xsd
xsize
xterm
xvalue
yaml
YDPI
yml
YOffset
YPosition
YSize
zero'd
zsh
zwj
These words are not needed and should be removed APCs bitmasks changelists clsids Cmts codepages COLORREFs colorschemes distros DPIs DWORDs flyouts frontends Fullscreens Ioctl keydowns keyups lto noexcepts nullopts OEMs pdbs popups reparented rgbs scancodes screenshots subkeys testenvs titlebars Tlgg toolbars UChars UINTs unittests wchars websites wstrings xamls ZWJs

Some files were automatically ignored 🙈

These sample patterns would exclude them:

^\Qsrc/host/ft_host/Host.Tests.Feature.rc\E$
^src/host/runut\.bat$

You should consider adding them to:

.github/actions/spelling/excludes.txt

File matching is via Perl regular expressions.

To check these files, more of their words need to be in the dictionary than not. You can use patterns.txt to exclude portions, add items to the dictionary (e.g. by adding them to allow.txt), or fix typos.

To accept these unrecognized words as correct, update file exclusions, and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the git@github.com:RAGHAV-0202/terminal.git repository
on the feature/random-color-scheme branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/cfb6f7e75bbfc89c71eaa30366d0c166f1bd9c8c/apply.pl' |
perl - 'https://github.com/microsoft/terminal/actions/runs/25002849484/attempts/1' &&
git commit -m 'Update check-spelling metadata'
Available 📚 dictionaries could cover words (expected and unrecognized) not in the 📘 dictionary

This includes both expected items (2082) from .github/actions/spelling/expect/74d92373e136649071b3c04dc8773f18deaf5e04.txt .github/actions/spelling/expect/alphabet.txt .github/actions/spelling/expect/expect.txt .github/actions/spelling/expect/web.txt and unrecognized words (780)

Dictionary Entries Covers Uniquely
cspell:software-terms/dict/softwareTerms.txt 1288 172 45
cspell:cpp/src/stdlib-cpp.txt 252 54 31
cspell:cpp/src/stdlib-c.txt 278 58 29
cspell:python/src/python/python-lib.txt 2417 123 15
cspell:node/dict/node.txt 891 85 12

Consider adding to the extra_dictionaries array (in the .github/actions/spelling/config.json file):

    "cspell:software-terms/dict/softwareTerms.txt",
    "cspell:cpp/src/stdlib-cpp.txt",
    "cspell:cpp/src/stdlib-c.txt",
    "cspell:python/src/python/python-lib.txt",
    "cspell:node/dict/node.txt",

To stop checking additional dictionaries, put (in the .github/actions/spelling/config.json file):

"check_extra_dictionaries": []
Pattern suggestions ✂️ (5)

You could add these patterns to .github/actions/spelling/patterns/c875a5cb6e36bb183455de4095762567c8c658a7.txt:

# Automatically suggested patterns

# hit-count: 6 file-count: 4
# imports
^import\s+(?:(?:static|type)\s+|)(?:[\w.]|\{\s*\w*?(?:,\s*(?:\w*|\*))+\s*\})+

# hit-count: 2 file-count: 1
# https/http/file urls
(?:\b(?:https?|ftp|file)://)[-A-Za-z0-9+&@#/*%?=~_|!:,.;]+[-A-Za-z0-9+&@#/*%=~_|]

# hit-count: 1 file-count: 1
# #pragma lib
^\s*#pragma comment\(lib, ".*?"\)

# hit-count: 1 file-count: 1
# Lorem
# Update Lorem based on your content (requires `ge` and `w` from https://github.com/jsoref/spelling; and `review` from https://github.com/check-spelling/check-spelling/wiki/Looking-for-items-locally )
# grep '^[^#].*lorem' .github/actions/spelling/patterns.txt|perl -pne 's/.*i..\?://;s/\).*//' |tr '|' "\n"|sort -f |xargs -n1 ge|perl -pne 's/^[^:]*://'|sort -u|w|sed -e 's/ .*//'|w|review -
# Warning, while `(?i)` is very neat and fancy, if you have some binary files that aren't proper unicode, you might run into:
# ... Operation "substitution (s///)" returns its argument for non-Unicode code point 0x1C19AE (the code point will vary).
# ... You could manually change `(?i)X...` to use `[Xx]...`
# ... or you could add the files to your `excludes` file (a version after 0.0.19 should identify the file path)
(?:(?:\w|\s|[,.])*\b(?i)(?:amet|consectetur|cursus|dolor|eros|ipsum|lacus|libero|ligula|lorem|magna|neque|nulla|suscipit|tempus)\b(?:\w|\s|[,.])*)

# hit-count: 1 file-count: 1
# French
# This corpus only had capital letters, but you probably want lowercase ones as well.
\b[LN]'+[a-z]{2,}\b

Alternatively, if a pattern suggestion doesn't make sense for this project, add a # to the beginning of the line in the candidates file with the pattern to stop suggesting it.

Errors, Warnings, and Notices ❌ (5)

See the 📂 files view, the 📜action log, 👼 SARIF report, or 📝 job summary for details.

❌ Errors, Warnings, and Notices Count
ℹ️ candidate-pattern 7
❌ check-file-path 2815
⚠️ duplicate-pattern 1
⚠️ ignored-expect-variant 1
⚠️ noisy-file 2

See ❌ Event descriptions for more information.

✏️ Contributor please read this

By default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.

If the listed items are:

  • ... misspelled, then please correct them instead of using the command.
  • ... names, please add them to .github/actions/spelling/allow/names.txt.
  • ... APIs, you can add them to a file in .github/actions/spelling/allow/.
  • ... just things you're using, please add them to an appropriate file in .github/actions/spelling/expect/.
  • ... tokens you only need in one place and shouldn't generally be used, you can add an item in an appropriate file in .github/actions/spelling/patterns/.

See the README.md in each directory for more information.

🔬 You can test your commits without appending to a PR by creating a new branch with that extra change and pushing it to your fork. The check-spelling action will run in response to your push -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. 😉

If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

@DHowett
Copy link
Copy Markdown
Member

DHowett commented Apr 27, 2026

to re-trigger CI

We trigger CI, you do not ;)

@RAGHAV-0202
Copy link
Copy Markdown
Author

RAGHAV-0202 commented Apr 27, 2026

to re-trigger CI

We trigger CI, you do not ;)

Got it , thanks. I thought checks were automatic.

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) ]

2 participants