You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何单独更改侧边栏主题?能否为侧边栏配置Dark主题且为编辑器配置Light主题?

How to Customize Sidebar Theme Separately (and Mix Dark Sidebar + Light Editor)

Hey there! Let me walk you through exactly how to pull this off—this is a super common customization request, especially for folks who prefer a dark navigation area but a light editing space.

Can I Set a Dark Sidebar + Light Editor?

Absolutely! Most modern code editors (like VS Code, which I’ll focus on since it’s the most widely used) let you mix and match theme components with granular settings or custom tweaks.

Step-by-Step Guide for VS Code

Method 1: Use Built-in Settings (No CSS Needed)

This is the easiest way, using VS Code’s native color customization options:

  1. Open your settings: Press Ctrl+, (Windows/Linux) or Cmd+, (Mac).
  2. First, set your editor to Light theme:
    • Search for editor.colorTheme and select a light theme (e.g., Light+ (Default Light)).
  3. Now, customize the sidebar to use Dark theme colors:
    • Search for workbench.colorCustomizations and click Edit in settings.json.
    • Paste the following code snippet into the JSON file—this replicates the core Dark+ theme styles for the sidebar and related UI elements:
      "workbench.colorCustomizations": {
        // Activity Bar & Sidebar Base Styles
        "activityBar.background": "#1e1e1e",
        "activityBar.foreground": "#cccccc",
        "sidebar.background": "#252526",
        "sidebar.foreground": "#cccccc",
        "sidebar.border": "#1e1e1e",
        // Sidebar Headers
        "sidebarSectionHeader.background": "#2d2d30",
        "sidebarSectionHeader.foreground": "#cccccc",
        // Explorer List Styles
        "list.activeSelectionBackground": "#0e639c",
        "list.activeSelectionForeground": "#ffffff",
        "list.hoverBackground": "#2a2d2e",
        "list.hoverForeground": "#ffffff"
      }
      
  4. Save the settings.json file, and you’ll see the sidebar switch to Dark while your editor stays Light instantly!

Method 2: Use Custom CSS (For Full Control)

If you want to tweak every tiny UI detail, you can use VS Code’s custom CSS support (note: this requires an extension):

  1. Install the Custom CSS and JS Loader extension from the marketplace.
  2. Create a new CSS file (e.g., sidebar-dark.css) with these styles:
    /* Activity Bar */
    .activitybar {
      background-color: #1e1e1e !important;
      color: #cccccc !important;
    }
    /* Sidebar Container */
    .sidebar {
      background-color: #252526 !important;
      color: #cccccc !important;
    }
    /* Sidebar Section Headers */
    .sidebar-section-header {
      background-color: #2d2d30 !important;
      color: #cccccc !important;
    }
    /* Selected/Hovered Explorer Items */
    .monaco-list-row.selected {
      background-color: #0e639c !important;
      color: #ffffff !important;
    }
    .monaco-list-row:hover {
      background-color: #2a2d2e !important;
      color: #ffffff !important;
    }
    
  3. In VS Code settings, add the path to your CSS file under vscode_custom_css.imports:
    "vscode_custom_css.imports": [
      "file:///path/to/your/sidebar-dark.css"
    ]
    
  4. Reload VS Code using the command Reload Custom CSS and JS (open the command palette with Ctrl+Shift+P or Cmd+Shift+P to run this).

Quick Notes for Other Editors

If you’re using a different editor, the approach is intuitive too:

  • Sublime Text: Use Package Control to install a theme that supports split UI/editor themes, or edit the .tmTheme file to override sidebar colors manually.
  • Atom: Head to Settings > Themes—Atom natively separates UI and syntax themes, so just set your UI theme to Dark and Syntax theme to Light!

内容的提问来源于stack exchange,提问作者free2idol1

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.29 15:42:43