image thumbnail

dark mode plot

version 1.12 (30.3 KB) by Natan
make MATLAB plots fit dark mode theme backgrounds


Updated 20 Oct 2021

From GitHub

View license on GitHub

dark mode plot

View dark mode plot  on File Exchange

Transform your MATLAB plots to fit dark mode theme backgrounds! The function test which of the figure colors are not suitable to be used over a dark background (via color contrast), and adjust colors accordingly using a desaturation and brightness approach. In addition, it transforms the relevant Matlab figure attributes, such as axis and text colors, and figure background. The result is a transformed figure that can be copied to a dark mode theme presentation or website.

Preparing this function I was inspired by

How to use the function: generate or import a Matlab figure and run the function, for example:


Copy the figure from the clipboard using Edit>Copy Figure and paste it on top of the dark background theme, for example in PowerPoint. Make sure that in the Copy Option, the Transparent Background is enabled. The function was tested with Matlab 2019b - Win10.


Known bugs:

  1. surf plot works on screen, but fails in the copy-paste procedure.
  2. Transparecy (alpha) is not considered by the adjustColor function, causing Minor Grids to be too dim at dark bkgs.

To Do:

  1. write a version of the sub function adjust_color to adjust colormaps based on similar reasoning, (or replace colormaps?)
  2. Extend adjustColor to objects that has alpha (transprency) property.

Cite As

Natan (2021). dark mode plot (, GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2019b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.