Dracula color theme for figures
Version 1.2.0 (1.56 MB) by
Austin M. Weber
MATLAB functions for converting your figures into a stylish dark color theme.
Dracula color theme for figures
MATLAB functions for converting your figures into a stylish dark color theme.
"Dracula" is a very popular color theme used by programmers who prefer to do their work in dark mode. You can apply the Dracula color theme to your MATLAB Desktop application by following the instructions here, and a list of the Dracula color codes can be found at this link.
However, by default, MATLAB figures are generated with a white background and it can be a pain to manually change all of the object colors in your figures to make them fit your dark mode color preferences. But now, thanks to the functions in this collection, converting your figures into Dracula-themed colors is as simple as using one line of code --- just call the draculize function after creating a figure!
See the examples below to view how the draculize function works in action.
Basic Plots
The syntax for making your figures Dracula themed is easy. Simply create a plot as you would normally and then call the function draculize with no inputs or outputs.
x = linspace(0,4*pi,25);
y1 = sin(x).*rand(size(x));
y2 = sin(x).*rand(size(x))+0.3;
y3 = sin(x).*rand(size(x))+0.6;
y4 = sin(x).*rand(size(x))-0.4;
figure(1)
subplot(2,3,1)
plot(x,[y1' y2' y3' y4'],'LineWidth',2), axis square tight
title('Line Plot')
draculize
subplot(2,3,2)
scatter(x,[y1' y2' y3' y4'],'.'), box on, axis square tight
title('Scatter Plot')
draculize
subplot(2,3,3)
bar(x,[y1' y2' y3' y4'],1,'stacked'), axis square tight
title('Bar Plot')
draculize
subplot(2,3,4)
stairs(x,[y1' y2' y3' y4'],'LineWidth',1), axis square tight
title('Stairs Plot')
draculize
subplot(2,3,5)
area(x,[y1' y2' y3' y4']), axis square tight
title('Area Plot')
draculize
subplot(2,3,6)
piechart([10 12 31 16 11 6 14],'FaceAlpha',1,ExplodedW=3)
title('Piechart')
draculize
The draculize function also works on any basic plots that contain a title, subtitle, axes labels, a legend, added text, and grid lines. It also works for 3D plots.
figure(2)
contour3(peaks,50)
title('This is a title'), subtitle('This is a subtitle')
xlabel('X-axis'), ylabel('Y-axis'), zlabel('Z-axis')
hold on
text(0,30,-5,'This is added text.')
hold off
grid on
L=legend('Data','Location','northeast'); L.Title.String='Legend';
cb=colorbar; cb.Label.String='Colorbar';
draculize
Note that if you add a label, legend, etc. after executing the draculize function, the new object(s) will not be automatically incorporated into the Dracula theme. You will need to call the draculize function again in order to update the figure.
Color Order
If you don't want to convert the entire figure into the Dracula theme, but want to use Dracula colors for your data in place of the default MATLAB colors, then call the function dracula_colororder after creating your plot.
figure(3)
subplot(1,2,1)
plot(x,[y1' y2' y3' y4'],'LineWidth',2), axis square tight
title('Default Color Order')
legend('Y1','Y2','Y3','Y4')
subplot(1,2,2)
plot(x,[y1' y2' y3' y4'],'LineWidth',2), axis square tight
title('Dracula Color Order')
legend('Y1','Y2','Y3','Y4')
dracula_colororder
Color Map
A custom Dracula-themed color map (dracula_cmap) is available in the dracula.mat binary file. This color map is automatically applied to a figure when using the draculize function. However, if they user only wants to use the color map without applying the full Dracula theme to a figure then simply call the dracula_colormap function!
figure(4)
sc = surfc(membrane); sc(2).LineWidth=2; zlim([-1 1])
title('Dracula Color Map')
colorbar
dracula_colormap