A guide to managing Cursor/VSCode workspace themes and settings through environment variables.
This guide shows how to configure your Cursor/VSCode workspace settings using .env files, allowing for:
- Dynamic theme management
- Project-specific configurations
- Shared workspace settings across team members
Add these variables to your .env file:
# Cursor Workspace Configuration
CURSOR_WORKSPACE="YourWorkspaceName"
CURSOR_PROJECT="Your Project Name"
# VSCode Theme Settings
VSCODE_COLOR_THEME="Default Dark+"
VSCODE_PREFERRED_DARK_THEME="Default Dark+"Create scripts/update-vscode-theme.ps1:
# Load .env file
$envContent = Get-Content -Path ".env" -Raw
$envLines = $envContent -split "`n" | Where-Object { $_ -match '^\s*[^#]' }
# Parse settings
$settings = @{}
foreach ($line in $envLines) {
if ($line -match 'VSCODE_COLOR_THEME=(.+)') {
$settings['workbench.colorTheme'] = $matches[1].Trim('"')
}
if ($line -match 'VSCODE_PREFERRED_DARK_THEME=(.+)') {
$settings['workbench.preferredDarkColorTheme'] = $matches[1].Trim('"')
}
if ($line -match 'CURSOR_WORKSPACE=(.+)') {
$workspaceName = $matches[1].Trim('"')
}
}
# Determine workspace file name
$workspaceFile = "$workspaceName.code-workspace"
# Create workspace if it doesn't exist
if (-not (Test-Path $workspaceFile)) {
@{
folders = @(@{ path = "." })
settings = @{}
extensions = @{
recommendations = @()
}
tasks = @{}
} | ConvertTo-Json -Depth 100 | Set-Content -Path $workspaceFile
}
# Read workspace file
$workspace = Get-Content -Path $workspaceFile -Raw | ConvertFrom-Json
# Update theme settings
$workspace.settings.'workbench.colorTheme' = $settings['workbench.colorTheme']
$workspace.settings.'workbench.preferredDarkColorTheme' = $settings['workbench.preferredDarkColorTheme']
# Save workspace file
$workspace | ConvertTo-Json -Depth 100 | Set-Content -Path $workspaceFile
Write-Host "VSCode theme settings updated from .env file for workspace: $workspaceFile"Your workspace file (e.g., YourWorkspace.code-workspace) will be automatically created/updated with:
{
"folders": [
{
"path": "."
}
],
"settings": {
"workbench.colorTheme": "Default Dark+",
"workbench.preferredDarkColorTheme": "Default Dark+",
"workbench.colorCustomizations": {
"statusBar.background": "#1a1a1a",
"statusBar.foreground": "#00ff00",
"activityBar.background": "#1a1a1a",
"activityBar.foreground": "#33FF66",
"titleBar.activeBackground": "#1a1a1a",
"titleBar.activeForeground": "#33FF66",
"editorCursor.foreground": "#33FF66",
"editorCursor.background": "#1a1a1a",
"terminalCursor.foreground": "#33FF66",
"terminalCursor.background": "#1a1a1a"
}
},
"tasks": {
"update-theme": {
"label": "Update Theme from ENV",
"type": "shell",
"command": "${workspaceFolder}/scripts/update-vscode-theme.ps1",
"problemMatcher": []
}
}
}- Update theme settings in
.env - Run the update task:
- From Command Palette:
Tasks: Run Task>Update Theme from ENV - Or run
./scripts/update-vscode-theme.ps1directly
- From Command Palette:
You can use any installed VSCode theme. Popular options include:
- "Default Dark+"
- "GitHub Dark"
- "One Dark Pro"
- "Dracula"
- "Night Owl"
- "Material Theme"
- Keep
.envin your.gitignoreto allow team members to use their preferred themes - Create an
.env.examplewith default theme settings - Use the task runner for easy theme switching
- Combine with other workspace settings for a complete development environment
Feel free to contribute improvements or report issues on GitHub!


