theme - Set or get graphics theme - MATLAB (original) (raw)
Main Content
Set or get graphics theme
Since R2025a
Syntax
Description
Set Theme
theme([newtheme](#mw%5Fe39f259c-fba5-4899-bccc-6270dd69bf16))
sets the theme of the current figure to the specified new theme, which can be "light"
,"dark"
, "auto"
, or aGraphicsTheme
object. Parentheses are optional for this syntax when you specify one of the theme names. For example, theme light
is the same as theme("light")
.
Calling this function sets the Theme
andThemeMode
properties of the figure.
theme([fig](#mw%5F4d0401ff-f03f-4974-9912-f68d19fc78b6),[newtheme](#mw%5Fe39f259c-fba5-4899-bccc-6270dd69bf16))
sets the theme of the specified figure.
[gt](#mw%5Fe7c960a0-ff72-4e87-a443-70f4436adb03) = theme(___)
sets the theme and returns it as a GraphicsTheme
object.
Get Theme
[gt](#mw%5Fe7c960a0-ff72-4e87-a443-70f4436adb03) = theme
returns the theme of the current figure as a GraphicsTheme
object.
[gt](#mw%5Fe7c960a0-ff72-4e87-a443-70f4436adb03) = theme([fig](#mw%5F4d0401ff-f03f-4974-9912-f68d19fc78b6))
returns the theme of the specified figure.
Examples
Create a figure and set its theme to "dark"
by calling the theme
function and returning the GraphicsTheme
object as gt
. Then create a bar chart in the figure.
fig = figure; gt = theme(fig,"dark"); bar([1 2 3 4; 5 6 7 8])
Change the theme to "light"
.
Use the GraphicsTheme
object, gt
, to set the theme.
Input Arguments
New theme, specified as "light"
, "dark"
,"auto"
, or a GraphicsTheme
object.
Target figure, specified as a Figure
object or an array ofFigure
objects.
Output Arguments
Graphics theme object with these properties.
Property | Description |
---|---|
Name | Short description of the theme, returned as 'Light Theme' or'Dark Theme'. |
BaseColorStyle | Basic color style of the theme, returned as 'light' or'dark'. This property indicates the overall lightness or darkness of the theme. Query this property when deciding on a color palette for your chart or when writing a ThemeChangedFcn callback. |
Version History
Introduced in R2025a