Generated banner for Matlab Apply Theme
Generated logo for Matlab Apply Theme

Matlab Apply Theme

MathWorksOfficialCreated by MathWorks

  • Skill
  • Tool integration
  • Software development
  • BSD-2-Clause
  • No issues found

From the author

Style MATLAB charts and figures. colororder palettes for chart series colors, colormap selection, brand color organization, and the R2025a Theme API for uifigure apps (dark mode with fliplightness, ThemeChangedFcn, uistyle, component colors). Use when customizing chart colors, applying a color palette, organizing brand colors, implementing dark mode, or importing an external color scheme. Triggers: theme, dark mode, brand colors, colororder, colormap, palette, fliplightness, color scheme, styling, chart colors.
— the description by MathWorks

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured approach to theming MATLAB charts and uifigure applications. It emphasizes the use of the R2025a Theme API to handle dark mode, brand color organization, and component styling. By centralizing colors into a structured format and utilizing semantic tokens, users can ensure consistent branding and responsive design across their MATLAB projects. The skill covers categorical color ordering, continuous colormaps, and conditional formatting via uistyle, while providing workflows for importing external color schemes.

What it does

  • Centralizes brand and palette colors into a reusable struct to avoid hardcoded values.
  • Implements dark mode support using the R2025a Theme API and fliplightness function.
  • Configures categorical chart series colors using colororder.
  • Applies continuous gradients to data visualizations via colormap.
  • Manages conditional formatting in tables and trees using uistyle.
  • Provides a workflow for mapping external color schemes like Material Design or Tailwind to MATLAB.

When to use it

  • When you need to apply a consistent brand color palette to MATLAB charts.
  • When developing uifigure apps that require automatic light and dark mode adaptation.
  • When you need to implement conditional styling for table or tree components.
  • When importing external design system colors into a MATLAB environment.

Advantages

  • Ensures consistent branding by centralizing color definitions.
  • Leverages native R2025a Theme API for seamless dark mode integration.
  • Reduces manual styling effort by using semantic tokens.
  • Prevents theme-breaking by providing clear guidance on when to avoid explicit color settings.

Usage examples

“How do I set up a custom color palette for my MATLAB line chart?”
The agent will guide you to define a struct containing your plotColors and apply them using the colororder function on your axes.
“Help me implement dark mode for my uifigure app using the R2025a Theme API.”
The agent will provide a template for a theme struct and show you how to wire the ThemeChangedFcn to update component colors dynamically.
“How can I import a Tailwind color scheme into my MATLAB project?”
The agent will explain how to convert hex values to normalized RGB, map them to the required theme struct fields, and test them with fliplightness.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/matlab/matlab-apply-theme/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip matlab-apply-theme.zip -d .agents/skills

Documentation by MathWorks

MATLAB Theming

Style MATLAB charts with color palettes and — for uifigure apps — apply the R2025a Theme API for brand colors, dark mode, and component styling.

When to Use This Skill

Use this skill when:

  • Setting colororder for chart series colors (any context)

  • Choosing or importing a color palette for plots

  • Organizing brand colors into a reusable struct

  • Applying a custom colormap for continuous data

  • Implementing dark mode with fliplightness() (uifigure)

  • Wiring ThemeChangedFcn to react to OS/user theme changes (uifigure)

  • Using uistyle for conditional formatting in tables/trees (uifigure)

  • Importing an external color scheme (Material Design, Adobe Color, Tailwind)

When NOT to Use This Skill

  • Choosing chart types or building charts from scratch (use matlab-build-chart)

  • Building a full app layout (use matlab-build-app — it invokes this skill for theming sub-steps)

  • Setting colors on individual plot elements as a one-off (just use the Color property directly)

  • Non-MATLAB styling (CSS, HTML themes for web apps)

Critical Rules

Universal (all contexts)
  • MUST centralize brand/palette colors in a struct — never scatter RGB values

  • ALWAYS use colororder() for categorical chart series colors

  • ALWAYS use colormap() for continuous scalar-mapped colors

  • NEVER confuse colororder (categorical series) with colormap (continuous gradient)

Additional rules for uifigure apps (R2025a Theme API)
  • MUST use R2025a Theme API — do NOT manually set figure background or standard component colors

  • MUST use fliplightness() to derive dark variants unless explicitly designing custom dark colors

  • NEVER set a component's color explicitly unless branding requires it — breaks theme adaptation

  • ALWAYS use the semantic token vocabulary defined below for cross-path consistency

Semantic Token Vocabulary

Both MATLAB and web implementations map to these common tokens. When importing an external color scheme, map its colors to these tokens once.

TokenPurposeMATLAB (struct field)Web (CSS variable)
primaryBrand/action color (buttons, links, active states)theme.primary--accent
onPrimaryText/icon on primary backgroundtheme.onPrimary--accent-text
secondarySecondary brand color (less prominent actions)theme.secondary--secondary
errorError/destructive statetheme.error--error
successSuccess/confirmation statetheme.success--success
warningWarning/caution statetheme.warning--warning
borderCustom borders and dividerstheme.border--border
plotColorsChart series colors (Nx3 RGB matrix)theme.plotColorsN/A (use chart library config)

MATLAB note: Surface/text colors (--bg-primary, --text-primary in CSS) are NOT in the MATLAB theme struct. The R2025a Theme API handles those automatically. Only define brand/custom colors.

Quick Start

Color palettes for any figure
colors = [0 0.447 0.741; 0.85 0.33 0.10; 0.93 0.69 0.13; ...
          0.49 0.18 0.56; 0.47 0.67 0.19; 0.30 0.75 0.93];
colororder(ax, colors);
% All series in this axes now cycle through these colors
Theme struct for uifigure apps (R2025a)
function theme = createTheme(mode)
    arguments
        mode string {mustBeMember(mode, ["light", "dark"])} = "light"
    end
    theme.primary = [0 0.447 0.741];    % MATLAB blue
    theme.onPrimary = [1 1 1];
    theme.error = [0.83 0.18 0.18];
    theme.success = [0.22 0.56 0.24];
    theme.border = [0.88 0.88 0.88];
    theme.plotColors = [0 0.447 0.741; 0.85 0.33 0.10; 0.93 0.69 0.13; ...
                        0.49 0.18 0.56; 0.47 0.67 0.19; 0.30 0.75 0.93; 0.64 0.08 0.18];
    if mode == "dark"
        theme.primary = fliplightness(theme.primary);
        theme.plotColors = fliplightness(theme.plotColors);
    end
end

Wiring to a figure:

fig.ThemeChangedFcn = @(src, ~) applyTheme(src, ax);

function applyTheme(fig, ax)
    theme = createTheme(fig.Theme.BaseColorStyle);
    colororder(ax, theme.plotColors);
end

Light/Dark Strategy

  1. Don't set figure background, standard component bg/text — Theme API handles it automatically

  2. Do set brand colors (primary buttons, accent labels, status indicators) via theme struct

  3. Use ThemeChangedFcn to swap brand colors when OS/user toggles dark mode

  4. Use fliplightness() to auto-derive dark brand colors from light definitions

  5. Leave ColorMode = "auto" on components wherever possible

What breaks automatic theming — setting any color explicitly switches ColorMode to "manual":

btn.BackgroundColor = [0.2 0.4 0.8];  % Now manual — won't adapt to theme
btn.BackgroundColorMode = "auto";       % Restore theme control

Color Types in MATLAB

TypeAPIWhen to use
Component colorsbtn.BackgroundColor, lbl.FontColorUI element branding
Series colorscolororder(colors) or colororder("palette")Multiple lines/bars/scatter in one axes
Continuous colorscolormap(map)Heatmaps, surfaces, contours, images
Cell/row stylinguistyle + addStyleConditional formatting in tables/trees
  • colororder = categorical (series A, B, C get distinct colors)

  • colormap = continuous (scalar values mapped to gradient)

  • Don't confuse them — they serve different purposes

Importing External Color Schemes

Workflow
  1. Pick a scheme from Material Design, Adobe Color, Tailwind, etc.

  2. Extract 5-7 key colors: primary, secondary, error, success, warning, border + 5-7 chart series colors

  3. Convert hex to [R G B] normalized 0-1: rgb = sscanf(hex(2:end), '%2x', 3)' / 255

  4. Map to theme struct fields: theme.primary, theme.secondary, etc.

  5. Test both modes: verify fliplightness() produces acceptable dark variants; override manually if not

  6. Apply via applyBrandColors: the function reads the struct and sets tagged components

See references/external-schemes.md for complete Material Design, Adobe Color, and Tailwind import examples.

Implementation Checklist

Styling
  • [ ] Brand colors centralized in createTheme struct

  • [ ] fliplightness() used for dark variants

  • [ ] Branded components tagged for findall lookup

  • [ ] ThemeChangedFcn wired to re-apply brand colors

  • [ ] colororder set from theme.plotColors

  • [ ] No explicit colors on auto-themed components

Troubleshooting

ProblemCauseFix
Component doesn't change with dark modeColor set explicitlyRemove explicit color or set BackgroundColorMode = "auto"
fliplightness not foundMATLAB < R2025aUpgrade or define manual dark colors
Chart colors don't update on theme switchcolororder not re-appliedAdd colororder(ax, theme.plotColors) to theme handler
findall returns emptyTag not set or misspelledVerify Tag property matches exactly

References

TopicFileDescription
Theme APIreferences/theme-api.mdR2025a lock/detect/react, auto vs manual theming
Component colorsreferences/component-colors.mdColor properties table + uistyle for tables/trees
External schemesreferences/external-schemes.mdMaterial Design, Adobe Color, Tailwind import workflows

Copyright 2026 The MathWorks, Inc.


Files

ATTRIBUTION.md

Attribution

This folder is an unmodified copy of the Agent Skill "matlab-apply-theme", distributed by AutoGineer (https://autogineer.com/agent-skills).

The skill's own files are unmodified copies. AutoGineer is not affiliated with or endorsed by the author or the publisher.

Files added by AutoGineer

  • ATTRIBUTION.md: this file, written by AutoGineer

  • LICENSE: copied from LICENSE.md

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Declares allowed tools

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
MathWorks
Publisher
MathWorks (Official)
Source
matlab/matlab-agentic-toolkit · skills-catalog/matlab-app-building/matlab-apply-theme · commit 2a7f215
Licence
BSD 2-Clause License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE.md)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by MathWorks.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download matlab-apply-theme.zip