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

如何修改VSCode中Jupyter Notebook单元格的背景色?求对应JSON配置项

Adjusting Jupyter Notebook Cell Background Colors in VS Code

Got it, I’ve been in your shoes—hunting through the theme docs and coming up empty on exactly which settings control Jupyter cell backgrounds. The good news is VS Code has specific, easy-to-use configuration keys for this, and you can tweak them directly in your settings.json file without ditching your preferred theme entirely.

Here’s how to make those subtle adjustments:

  1. Open your settings in JSON format
    Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac), then search for and select Preferences: Open Settings (JSON). This opens your user-level settings file where you can add custom color overrides.

  2. Add the cell background configuration keys
    Below are the most useful settings for fine-tuning Jupyter cell backgrounds—pick the ones you need and set them to your desired hex color code:

    • notebook.cellBackground: Controls the default background color of all cells (code and Markdown, unless you override Markdown separately)
    • notebook.activeCellBackground: Background color of the cell you’re currently editing
    • notebook.selectedCellBackground: Background color when you select a cell (click its gutter or the cell itself)
    • notebook.markdownCellBackground: Use this if you want a distinct background for Markdown cells

    Example configuration to tweak these values:

    {
      // Keep your existing settings here...
      "notebook.cellBackground": "#f8f9fa",
      "notebook.activeCellBackground": "#e3f2fd",
      "notebook.selectedCellBackground": "#e9ecef",
      "notebook.markdownCellBackground": "#ffffff"
    }
    
  3. Save and see changes
    Save the settings.json file, and VS Code will automatically apply the new colors—no restart needed. If your theme already defines these values, your custom entries will override them, so you can keep using your preferred theme while making this small, targeted adjustment.

A quick note: These settings work specifically for Jupyter notebooks too—VS Code’s unified notebook system uses the same cell styling under the hood for all notebook types, so you don’t need extra Jupyter-specific keys.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.29 08:47:37