Skip to main content
Sanity Studio’s appearance can be customized through themes, which control colors, fonts, and other design tokens.

StudioTheme

The StudioTheme interface extends Sanity UI’s RootTheme with Studio-specific customizations.
import {type StudioTheme} from 'sanity'

const myTheme: StudioTheme = {
  color: {
    // Color configuration
  },
  fonts: {
    // Font configuration
  }
}

Theme Configuration

Configure themes in your Studio config:
import {defineConfig} from 'sanity'
import {myTheme} from './theme'

export default defineConfig({
  // ...
  theme: myTheme
})

Color Customization

Customize the Studio’s color palette:
import {defineConfig} from 'sanity'

export default defineConfig({
  theme: {
    color: {
      dark: {
        default: {
          base: {
            bg: '#1a1a1a',
            fg: '#ffffff',
            // ... more colors
          }
        }
      },
      light: {
        default: {
          base: {
            bg: '#ffffff',
            fg: '#000000',
            // ... more colors
          }
        }
      }
    }
  }
})

Color Properties

color.dark
ThemeColorScheme
Dark mode color scheme
color.light
ThemeColorScheme
Light mode color scheme
Each color scheme contains:
default.base.bg
string
Background color
default.base.fg
string
Foreground (text) color
default.base.border
string
Border color
default.base.focusRing
string
Focus ring color
default.base.shadow
string
Shadow color

Font Customization

Customize typography:
import {defineConfig} from 'sanity'

export default defineConfig({
  theme: {
    fonts: {
      code: {
        family: 'Fira Code, monospace',
        sizes: [
          {fontSize: 13, lineHeight: 21, letterSpacing: 0},
          {fontSize: 16, lineHeight: 25, letterSpacing: 0},
          {fontSize: 18, lineHeight: 28, letterSpacing: 0},
          {fontSize: 21, lineHeight: 33, letterSpacing: 0},
          {fontSize: 26, lineHeight: 41, letterSpacing: 0},
        ],
        weights: {
          regular: 400,
          medium: 500,
          semibold: 600,
          bold: 700,
        },
      },
      heading: {
        family: 'Inter, sans-serif',
        // ...
      },
      text: {
        family: 'Inter, sans-serif',
        // ...
      },
    }
  }
})

Font Properties

fonts.code
ThemeFont
Font for code blocks and monospace text
fonts.heading
ThemeFont
Font for headings
fonts.text
ThemeFont
Font for body text
Each ThemeFont contains:
family
string
required
CSS font-family value
sizes
ThemeFontSize[]
required
Array of font size definitions
fontSize
number
Font size in pixels
lineHeight
number
Line height in pixels
letterSpacing
number
Letter spacing
weights
ThemeFontWeights
required
Font weight definitions
regular
number
Regular weight (typically 400)
medium
number
Medium weight (typically 500)
semibold
number
Semibold weight (typically 600)
bold
number
Bold weight (typically 700)

Color Scheme Control

Control which color schemes are available:
import {defineConfig, type StudioColorScheme} from 'sanity'

export default defineConfig({
  // Force dark mode only
  theme: myTheme,
  // Note: To control scheme programmatically, use Studio component props
})

StudioColorScheme

type StudioColorScheme = 'light' | 'dark' | 'system'
  • 'light' - Light mode
  • 'dark' - Dark mode
  • 'system' - Follow system preferences

Custom Theme Example

Complete custom theme:
// theme.ts
import {type StudioTheme} from 'sanity'

export const customTheme: StudioTheme = {
  color: {
    dark: {
      default: {
        base: {
          bg: '#0f172a',
          fg: '#f8fafc',
          border: '#334155',
          focusRing: '#3b82f6',
          shadow: {umbra: '#000', penumbra: '#000', ambient: '#000'},
        },
        accent: {
          fg: '#3b82f6',
        },
        positive: {
          bg: '#065f46',
          fg: '#d1fae5',
        },
        caution: {
          bg: '#92400e',
          fg: '#fef3c7',
        },
        critical: {
          bg: '#7f1d1d',
          fg: '#fee2e2',
        },
      },
    },
    light: {
      default: {
        base: {
          bg: '#ffffff',
          fg: '#0f172a',
          border: '#cbd5e1',
          focusRing: '#3b82f6',
          shadow: {umbra: '#000', penumbra: '#000', ambient: '#000'},
        },
        accent: {
          fg: '#2563eb',
        },
        positive: {
          bg: '#d1fae5',
          fg: '#065f46',
        },
        caution: {
          bg: '#fef3c7',
          fg: '#92400e',
        },
        critical: {
          bg: '#fee2e2',
          fg: '#7f1d1d',
        },
      },
    },
  },
  fonts: {
    code: {
      family: '"JetBrains Mono", monospace',
      sizes: [
        {fontSize: 13, lineHeight: 21, letterSpacing: 0},
        {fontSize: 16, lineHeight: 25, letterSpacing: 0},
        {fontSize: 18, lineHeight: 28, letterSpacing: 0},
        {fontSize: 21, lineHeight: 33, letterSpacing: 0},
      ],
      weights: {regular: 400, medium: 500, semibold: 600, bold: 700},
    },
    heading: {
      family: '"Inter", system-ui, sans-serif',
      sizes: [
        {fontSize: 14, lineHeight: 21, letterSpacing: 0},
        {fontSize: 16, lineHeight: 24, letterSpacing: 0},
        {fontSize: 20, lineHeight: 30, letterSpacing: 0},
        {fontSize: 24, lineHeight: 33, letterSpacing: 0},
        {fontSize: 32, lineHeight: 39, letterSpacing: 0},
      ],
      weights: {regular: 400, medium: 600, semibold: 700, bold: 800},
    },
    text: {
      family: '"Inter", system-ui, sans-serif',
      sizes: [
        {fontSize: 13, lineHeight: 21, letterSpacing: 0},
        {fontSize: 16, lineHeight: 25, letterSpacing: 0},
        {fontSize: 18, lineHeight: 28, letterSpacing: 0},
        {fontSize: 21, lineHeight: 33, letterSpacing: 0},
      ],
      weights: {regular: 400, medium: 500, semibold: 600, bold: 700},
    },
  },
}

// sanity.config.ts
import {defineConfig} from 'sanity'
import {customTheme} from './theme'

export default defineConfig({
  // ...
  theme: customTheme,
})

Using with Studio Component

Control scheme programmatically:
import {Studio} from 'sanity'
import {useState} from 'react'
import config from './sanity.config'

function App() {
  const [scheme, setScheme] = useState<'light' | 'dark' | 'system'>('system')
  
  return (
    <Studio 
      config={config}
      scheme={scheme}
      onSchemeChange={setScheme}
    />
  )
}

Build docs developers (and LLMs) love