Skip to main content
Gradio provides a theming system that allows you to customize the appearance of your applications.

Theme

The base Theme class that all Gradio themes inherit from. You can create custom themes by subclassing this class or by loading themes from the Hugging Face Hub.

Methods

from_hub

Load a theme from the Hugging Face Hub. This does NOT require a HuggingFace account for downloading publicly available themes.
str
required
String of the form <author>/<theme-name>@<semantic-version-expression>. If a semantic version expression is omitted, the latest version will be fetched.
str | None
default:"None"
Hugging Face token. Only needed to download private themes.
Theme
A Theme instance loaded from the Hub.

Example

load

Load a theme from a JSON file.
str
required
The filepath to read.
Theme
A Theme instance loaded from the file.

from_dict

Create a theme instance from a dictionary representation.
dict[str, dict[str, str]]
required
The dictionary representation of the theme.
Theme
A Theme instance.

to_dict

Convert the theme into a Python dictionary.
dict
Dictionary representation of the theme.

dump

Write the theme to a JSON file.
str
required
The path to write the theme to.

Built-in Themes

Gradio includes several built-in themes that you can use:

Base

The base theme that all other themes inherit from.

Default

The default Gradio theme.

Soft

A soft, rounded theme with pastel colors.

Monochrome

A minimalist black and white theme.

Glass

A theme with glassmorphism effects.

Origin

A theme inspired by the original Gradio design.

Citrus

A bright, citrus-colored theme.

Ocean

A calm, ocean-inspired theme.

Custom Themes

You can create custom themes by extending the base Theme class:

Theme Variables

Themes support the following customizable variables:

Color Variables

  • primary_hue: Primary color hue
  • secondary_hue: Secondary color hue
  • neutral_hue: Neutral color hue

Size Variables

  • text_size: Text size scale
  • spacing_size: Spacing size scale
  • radius_size: Border radius size scale

Font Variables

  • font: Main font family
  • font_mono: Monospace font family

Example: Using a Custom Theme

Example: Loading from Hub

Notes

  • Themes are applied to the entire Blocks interface
  • You can share custom themes on the Hugging Face Hub
  • Theme variables use CSS custom properties under the hood
  • Dark mode is automatically supported for all themes