{"id":3041,"date":"2025-07-22T07:25:12","date_gmt":"2025-07-22T11:25:12","guid":{"rendered":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/?p=3041"},"modified":"2025-07-22T07:46:27","modified_gmt":"2025-07-22T11:46:27","slug":"a-guide-to-themes-for-chart-creators-and-app-builders","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/2025\/07\/22\/a-guide-to-themes-for-chart-creators-and-app-builders\/","title":{"rendered":"A Guide to Themes for Chart Creators and App Builders"},"content":{"rendered":"<div class=\"rtcContent\">\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">The long-awaited dark theme is now available in MATLAB R2025a. This article serves as a guide for designing charts and apps in a specific theme or that adapt automatically to either theme. By default, the graphics theme matches the desktop theme, so charts and apps appear in dark or light theme depending on system settings. These preferences can be adjusted in the MATLAB Settings dialog.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">Color selection plays a critical role in a themed environment. A color that stands out in light theme may be difficult to see in dark theme. To address this, the default color system in MATLAB graphics is designed to adapt automatically and maintain color contrast across themes. Manually set colors, however, are treated as intentional design choices and do not adapt to theme changes.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">This article reviews strategies for managing chart appearance in a themed environment. It includes steps for designing graphical content for a specific theme or for making charts and apps theme-adaptive. For a broader overview of themes in MATLAB, check out Abby Skofield\u2019s recent article, <a href=\"https:\/\/blogs.mathworks.com\/graphics-and-apps\/2025\/07\/07\/dark-theme-for-plots-and-apps\/\" target=\"_blank\" rel=\"noopener\">Dark Theme for Plots and Apps<\/a>.<\/div>\r\n<h2 style=\"margin: 20px 10px 5px 4px;padding: 0px;line-height: 25px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 20px;font-weight: bold;text-align: left\">1. Understanding how color properties respond to themes<\/h2>\r\n<h3 style=\"margin: 15px 10px 5px 4px;padding: 0px;line-height: 20.4px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 17px;font-weight: bold;text-align: left\">Default colors adapt to the figure's current theme<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">Color properties that are not manually set use default values. For example, <span style=\"font-family: monospace\">h=plot(magic(3))<\/span> generates three lines with colors defined by the axes' <span style=\"font-family: monospace\">ColorOrder<\/span> property. The <span style=\"font-family: monospace\">ColorMode<\/span> property of these line objects is <span style=\"font-family: monospace\">'auto'<\/span> which indicates that default colors were assigned to the objects. A key feature of MATLAB Themes is that default colors will update automatically according to the figure's theme.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline;width: 905px;height: 356px\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/07\/aGuideToThemes.mlx-07-21-25_1.png\" alt=\"\" width=\"905\" height=\"356\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-style: italic\">A figure using default colors that adapt to light and dark theme<\/span><\/div>\r\n<h3 style=\"margin: 15px 10px 5px 4px;padding: 0px;line-height: 20.4px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 17px;font-weight: bold;text-align: left\">Manually set colors are unaffected by the figure's current theme<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">When a color property is set manually, it no longer uses the default color value and does not adapt to the figure's theme. For example, <span style=\"font-family: monospace\">h=plot([2 5 4],'-k')<\/span> generates a black line and the line's <span style=\"font-family: monospace\">ColorMode<\/span> property is <span style=\"font-family: monospace\">'manual'<\/span>. Manually set colors are assumed to be intentional design choices and are unaffected by the figure's theme. If this line is generated in a dark theme, color contrast between the line and the axes background is significantly reduced, making the line nearly invisible. Consider the example below where green lines highlight data labeled as \u201cSuccess\u201d while gray is used to deemphasize data labeled \u201cFail\u201d in light theme (left). Since those colors were manually set, they are preserved when dark theme is applied (right). However, in dark theme, the focus is reversed as gray \u201cFail\u201d data are emphasized while the green \u201cSuccess\u201d data may be difficult to see.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline;width: 908px;height: 295px\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/07\/aGuideToThemes.mlx-07-21-25_2.png\" alt=\"\" width=\"908\" height=\"295\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-style: italic\">Colors chosen for light theme manually applied in dark theme<\/span><\/div>\r\n<h3 style=\"margin: 15px 10px 5px 4px;padding: 0px;line-height: 20.4px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 17px;font-weight: bold;text-align: left\">Colormaps and Truecolor arrays are unaffected by themes<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">Colors determined by a colormap (e.g. surfaces, contours) or a Truecolor array (e.g. images, icons) are not affected by the graphics theme. Exceptions to this rule include some charts that use, by default, the <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/sky.html\"><span style=\"font-family: monospace\">sky<\/span><\/a> colormap in light theme and the <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/abyss.html\"><span style=\"font-family: monospace\">abyss<\/span><\/a> colormap in dark theme (e.g. <span style=\"font-family: monospace\">heatmap<\/span>, <span style=\"font-family: monospace\">binscatter<\/span>).<\/div>\r\n<h2 style=\"margin: 3px 10px 5px 4px;padding: 0px;line-height: 25px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 20px;font-weight: bold;text-align: left\">2. Designing charts and apps in a themed environment<\/h2>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">By default, the graphics theme in R2025a is set to match the MATLAB desktop theme which is set to match the system's theme. Desktop and graphics theme defaults can be changed in the settings panel (see <a href=\"https:\/\/blogs.mathworks.com\/graphics-and-apps\/2025\/07\/07\/dark-theme-for-plots-and-apps\/\" target=\"_blank\" rel=\"noopener\">Dark Theme for Plots and Apps<\/a>). Since different MATLAB installations may have different preferences, the same chart or app could appear with different themes. I\u2019ll review three recommended strategies for designing charts in a themed environment.<\/div>\r\n<ol style=\"margin: 10px 0px 20px;padding-left: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-size: 14px\">\r\n \t<li style=\"margin-left: 56px;line-height: 21px;min-height: 0px;text-align: left\">Revert manually set colors to use default colors<\/li>\r\n \t<li style=\"margin-left: 56px;line-height: 21px;min-height: 0px;text-align: left\">Design charts for a specific theme that is unaffected by preferences<\/li>\r\n \t<li style=\"margin-left: 56px;line-height: 21px;min-height: 0px;text-align: left\">Design charts that update manually set colors when the theme changes<\/li>\r\n<\/ol>\r\n<h3 style=\"margin: 15px 10px 5px 4px;padding: 0px;line-height: 20.4px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 17px;font-weight: bold;text-align: left\">Strategy 1: Revert manually set colors to default colors<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-style: italic\">Use this strategy when setting color is not necessary.<\/span><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">In data visualization, color is often used to convey meaning, perceptual grouping, branding, and aesthetics. Sometimes manual color assignment is applied out of habit, without necessity, or as a result of haphazard copy-pasting. In these cases, the best approach is to find and remove unnecessary color assignments from the code. By removing color assignments, the color properties will revert to default color values which will adapt to the figure's theme.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">To find manual color assignments, look for color definitions in positional input arguments, name-value pairs, or when setting properties on a graphics objects. Simply remove those color definitions. This table shows some common color assignment patterns and how to remove them:<\/div>\r\n&nbsp;\r\n<table style=\"margin: 3px;border-collapse: collapse\">\r\n<tbody>\r\n<tr>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-weight: bold\">Manual color definition<\/span><\/div><\/td>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-weight: bold\">Default colors<\/span><\/div><\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">text(x, y, string, <span style=\"color: #a709f5\">'Color'<\/span>, <span style=\"color: #a709f5\">'k'<\/span>)<\/span><\/div><\/td>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">text(x, y, string)<\/span><\/div><\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">figure(Color=<span style=\"color: #a709f5\">'white'<\/span>)<\/span><\/div><\/td>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">figure()<\/span><\/div><\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">bar(y,<span style=\"color: #a709f5\">'blue'<\/span>)<\/span><\/div><\/td>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">bar(y)<\/span><\/div><\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">plot(x,y,<span style=\"color: #a709f5\">'--k'<\/span>)<\/span><\/div><\/td>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">plot(x,y,<span style=\"color: #a709f5\">'--'<\/span>)<\/span><\/div><\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">scatter(x,y,size,<span style=\"color: #a709f5\">'black'<\/span>,<span style=\"color: #a709f5\">'filled'<\/span>,<span style=\"color: #a709f5\">'diamond'<\/span>)<\/span><\/div><\/td>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">scatter(x,y,size,<span style=\"color: #a709f5\">'filled'<\/span>,<span style=\"color: #a709f5\">'diamond'<\/span>)<\/span><\/div><\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">set(h,<span style=\"color: #a709f5\">'Color'<\/span>,[r g b])<\/span><\/div><\/td>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">&lt;delete&gt;<\/span><\/div><\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">h.MarkerFaceColor = [r g b]; <\/span><\/div><\/td>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">&lt;delete&gt;<\/span><\/div><\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">h1.Color = h2.Color;<\/span><\/div><\/td>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">h1.SeriesIndex = h2.SeriesIndex; <\/span><\/div>\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">*<\/span><span style=\"font-style: italic\">Not all objects have a SeriesIndex property<\/span><\/div><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">Tip: If you're having trouble finding where a color property is set, call the listener below after the object is created. When the color property is changed, a warning will appear showing where the color property was set. Replace <span style=\"font-family: monospace\">h<\/span> with the variable containing the object handle and replace <span style=\"font-family: monospace\">Color<\/span> with the color property name. In this example, the <span style=\"font-family: monospace\">Color<\/span> property on object <span style=\"font-family: monospace\">h<\/span> was set on line 102 in the script named \"demo\".<\/div>\r\n<div class=\"preformatted-matlab\" style=\"margin: 10px 3px 10px 55px;padding: 10px 10px 10px 5px\">\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">&gt;&gt; addlistener(h,<span style=\"color: #a709f5\">'Color'<\/span>,<span style=\"color: #a709f5\">'PreSet'<\/span>,@(~,~)warning(<span style=\"color: #a709f5\">'Color value set.'<\/span>));<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">Warning: Color value set.<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">&gt; In demo&gt;@(~,~)warning(<span style=\"color: #a709f5\">'Color value set.'<\/span>)<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">In demo (line 102)<\/div>\r\n<\/div>\r\n<h3 style=\"margin: 15px 10px 5px 4px;padding: 0px;line-height: 20.4px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 17px;font-weight: bold;text-align: left\">Strategy 2: Design charts and apps for a specific theme unaffected by preferences<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-style: italic\">Use this strategy when designing specifically for light or dark theme.<\/span><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">If a chart or app is intended to appear in a particular theme, explicitly set the figure\u2019s <span style=\"font-family: monospace\">Theme<\/span> property. Doing so overrides the graphics theme preference, ensuring the figure always appears as designed. For example, to preserve the appearance of charts created prior to R2025a, set the figure's theme to <span style=\"font-family: monospace\">light<\/span>. In App Designer, set the figure\u2019s Theme property either in the Component Browser or programmatically in the app\u2019s startup function.<\/div>\r\n<table style=\"margin: 3px;border-collapse: collapse;height: 143px;width: 300px\">\r\n<tbody>\r\n<tr>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-weight: bold\">Setting the figure's theme property<\/span><\/div><\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">figure(Theme=<span style=\"color: #a709f5\">\"light\"<\/span>)<\/span><\/div><\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">theme(fig,<span style=\"color: #a709f5\"> \"dark\"<\/span>)<\/span><\/div><\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">fig.Theme =<span style=\"color: #a709f5\"> \"light\"<\/span>;<\/span><\/div><\/td>\r\n<\/tr>\r\n<tr>\r\n<td style=\"vertical-align: top;border: 1px solid #444\">\r\n<div style=\"margin: 2px 10px 2px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-family: monospace\">set(fig, <span style=\"color: #a709f5\">\"Theme\"<\/span>, <span style=\"color: #a709f5\">\"dark\"<\/span>)<\/span><\/div><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">Tip: To preserve compatibility with MATLAB releases prior to R2025a, set the <span style=\"font-family: monospace\">Theme<\/span> property conditionally based on the current MATLAB release. See <span style=\"font-family: monospace\">isMATLABReleaseOlderThan<\/span> (since R2020b) or <span style=\"font-family: monospace\">verLessThan.<\/span><\/div>\r\n<div class=\"preformatted-matlab\" style=\"margin: 10px 3px 10px 55px;padding: 10px 10px 10px 5px\">\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">fig = figure();<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #0e00ff\">if<\/span> ~verLessThan(<span style=\"color: #a709f5\">\"matlab\"<\/span>,<span style=\"color: #a709f5\">\"25.0\"<\/span>) <span style=\"color: #008013\">% R2025a<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">\u00a0\u00a0\u00a0\u00a0theme(fig, <span style=\"color: #a709f5\">\"light\"<\/span>)<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #0e00ff\">end<\/span><\/div>\r\n<\/div>\r\n<h3 style=\"margin: 15px 10px 5px 4px;padding: 0px;line-height: 20.4px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 17px;font-weight: bold;text-align: left\">Strategy 3: Design charts and apps that update manually set colors when the theme changes<\/h3>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-style: italic\">Use this strategy to support theme-adaptive manually set colors.<\/span><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">This strategy is intended for cases where a chart or app should remain visually effective and accessible in both light and dark themes, while using manually assigned colors. This is achieved by programmatically updating color values when the theme changes.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">There are two main approaches, depending on how your chart or app is constructed:<\/div>\r\n<ol style=\"margin: 10px 0px 20px;padding-left: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-size: 14px\">\r\n \t<li style=\"margin-left: 56px;line-height: 21px;min-height: 0px;text-align: left\">For charts and apps created as a collection of graphics or UI objects within a script or apps created in App Designer, use the figure's <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/matlab.ui.figure.html#mw_32495ae3-aae8-4d87-8348-5b96a85c689d\" target=\"_blank\" rel=\"noopener\"><span style=\"font-family: monospace\">ThemeChangedFcn<\/span><\/a> callback to update colors in response to theme changes.<\/li>\r\n \t<li style=\"margin-left: 56px;line-height: 21px;min-height: 0px;text-align: left\">For custom chart classes built with <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/matlab.graphics.chartcontainer.chartcontainer-class.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-family: monospace\">ChartContainer<\/span><\/a> or custom UI components created with <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/matlab.ui.componentcontainer.componentcontainer-class.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-family: monospace\">ComponentContainer<\/span><\/a>, use the <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/matlab.graphics.chartcontainer.chartcontainer.gettheme.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-family: monospace\">getTheme<\/span><\/a> method within the container\u2019s update method to set colors for each theme.<\/li>\r\n<\/ol>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">The following sections walk through the recommended workflow for each approach.<\/div>\r\n<h4 style=\"margin: 10px 10px 5px 4px;padding: 0px;line-height: 18px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 15px;font-weight: bold;text-align: left\"><span style=\"font-weight: bold;font-family: monospace\">ThemeChangedFcn<\/span><span style=\"font-weight: bold\">: for charts and apps created from a collection of graphics objects<\/span><span style=\"font-weight: bold\"> and with App Designer<\/span><\/h4>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">The <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/matlab.ui.figure.html#mw_32495ae3-aae8-4d87-8348-5b96a85c689d\" target=\"_blank\" rel=\"noopener\"><span style=\"font-family: monospace\">ThemeChangedFcn<\/span><\/a> is a callback function introduced on figure objects in R2025a. This callback is invoked when there is a change to the figure's theme. Property values for graphics objects can be updated within the callback function according to the current theme. MATLAB automatically passes two input arguments to the <span style=\"font-family: monospace\">ThemeChangedFcn<\/span>: the first is the figure handle, and the second is a <span style=\"font-family: monospace\">ThemeChangedData<\/span> object generated by the callback event. The <span style=\"font-family: monospace\">Theme<\/span> property of both the figure and the <span style=\"font-family: monospace\">ThemeChangedData<\/span> object returns a <span style=\"font-family: monospace\">GraphicsTheme\u00a0<\/span>object. The <span style=\"font-family: monospace\">GraphicsTheme<\/span> object contains a <span style=\"font-family: monospace\">BaseColorStyle<\/span> property that indicates the figure's current theme as <span style=\"font-family: monospace\">'dark'<\/span> or <span style=\"font-family: monospace\">'light'<\/span>. The figure's previous theme is also available in the <span style=\"font-family: monospace\">ThemeChangedData<\/span>. The content of these objects is shown below.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline;width: 901px;height: 174px\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/07\/aGuideToThemes.mlx-07-21-25_3.png\" alt=\"\" width=\"901\" height=\"174\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-style: italic\">Screenshots of the GraphicsTheme and ThemeChangedData objects<\/span><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">With the current theme identified, property values can be updated conditionally within the callback to control manual color assignment in any theme. The example below applies a <span style=\"font-family: monospace\">ThemeChangedFcn<\/span> to a plot depicting Newton\u2019s Law of Cooling. Object handles are stored in a structure <span style=\"font-family: monospace\">h<\/span> for easier function exchange and readability. The structure is passed to the <span style=\"font-family: monospace\">ThemeChangedFcn<\/span> where colors are applied according to the current figure theme (see the full file: <a href=\"https:\/\/raw.githubusercontent.com\/MATLAB-Graphics-and-App-Building\/matlab-gaab-blog-2025\/main\/GuideToThemesForChartAppAuthors\/NewtonsLawOfCoolingDemo.m\" target=\"_blank\" rel=\"noopener\">NewtonsLawOfCoolingDemo.m<\/a>).<\/div>\r\n<div class=\"preformatted-matlab\" style=\"margin: 10px 3px 10px 55px;padding: 10px 10px 10px 5px\">\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #008013\">% Create graphics objects<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">fig = figure();<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">hold <span style=\"color: #a709f5\">on<\/span>;<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">h = struct(); <span style=\"color: #008013\">% Used to store graphics handles<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">h.coolingCurve = plot(__,<span style=\"color: #a709f5\"> '-'<\/span>, LineWidth=2);<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">h.thresholdLine = yline(__, <span style=\"color: #a709f5\">'--'<\/span>, LineWidth=2);<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">h.safeHandlingPoint = plot(__, <span style=\"color: #a709f5\">'o'<\/span>, MarkerSize=8);<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #008013\">% Define ThemeChangedFcn<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">fig.ThemeChangedFcn = @(fig,data)updateManualColors(fig, data, h);<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">updateManualColors(fig,[],h) <span style=\"color: #008013\">% initialize using the current figure theme<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #0e00ff\">function<\/span> updateManualColors(fig,~,h)<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">% ThemeChangedFcn: invoked when the theme changes.<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #0e00ff\">if<\/span> fig.Theme.BaseColorStyle == <span style=\"color: #a709f5\">\"dark\"<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">\u00a0\u00a0\u00a0<span style=\"color: #008013\">\u00a0% Dark theme colors<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">\u00a0\u00a0\u00a0\u00a0h.coolingCurve.Color = [0.6 0.7 1];<span style=\"color: #008013\"> % lighter blue<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">\u00a0\u00a0\u00a0\u00a0h.thresholdLine.Color = [1 0.2 0.2];<span style=\"color: #008013\"> % lighter red<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">\u00a0\u00a0\u00a0\u00a0h.safeHandlingPoint.MarkerFaceColor = [0 .6 0]; <span style=\"color: #008013\">% darker green<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">\u00a0\u00a0\u00a0\u00a0h.safeHandlingPoint.MarkerEdgeColor = [0.5 0.8 0.5]; <span style=\"color: #008013\">% lighter green<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #0e00ff\">else<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">\u00a0<span style=\"color: #008013\">\u00a0\u00a0\u00a0% Light theme colors<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">\u00a0\u00a0\u00a0\u00a0h.coolingCurve.Color = [0 0 1];<span style=\"color: #008013\"> % blue<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">\u00a0\u00a0\u00a0\u00a0h.thresholdLine.Color = [1 0 0]; <span style=\"color: #008013\">% red<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">\u00a0\u00a0\u00a0\u00a0h.safeHandlingPoint.MarkerFaceColor = [0 1 0]; <span style=\"color: #008013\">% green<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">\u00a0\u00a0\u00a0\u00a0h.safeHandlingPoint.MarkerEdgeColor = [0 0.4 0];<span style=\"color: #008013\"> % dark green<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #0e00ff\">end<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #0e00ff\">end<\/span><\/div>\r\n<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">The colors that appear in light theme and dark theme are shown below.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline;width: 906px;height: 397px\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/07\/aGuideToThemes.mlx-07-21-25_4.png\" alt=\"\" width=\"906\" height=\"397\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-style: italic\">Colors manually set by the ThemeChangedFcn for light and dark themes<\/span><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">Other properties that do not participate in themes such as colormaps (e.g., sky, abyss), images, or icons, can also be updated within the callback.<\/div>\r\n<h4 style=\"margin: 10px 10px 5px 4px;padding: 0px;line-height: 18px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 15px;font-weight: bold;text-align: left\"><span style=\"font-weight: bold\">Chart or app initialization using the <\/span><span style=\"font-weight: bold;font-family: monospace\">ThemeChangedFcn<\/span><\/h4>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">The <span style=\"font-family: monospace\">ThemeChangedFcn<\/span> is only invoked when the figure\u2019s theme changes. When the figure is initialized in the default theme, the <span style=\"font-family: monospace\">ThemeChangedFcn<\/span> is not invoked, so any color assignment within the <span style=\"font-family: monospace\">ThemeChangedFcn<\/span> will not be executed. There are two approaches to ensure the figure is initialized with the manually set colors defined in the <span style=\"font-family: monospace\">ThemeChangedFcn<\/span>.<\/div>\r\n<ol style=\"margin: 10px 0px 20px;padding-left: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-size: 14px\">\r\n \t<li style=\"margin-left: 56px;line-height: 21px;min-height: 0px;text-align: left\"><span style=\"font-weight: bold\">Directly call the <\/span><span style=\"font-weight: bold;font-family: monospace\">ThemeChangedFcn<\/span>: Recall that the <span style=\"font-family: monospace\">ThemeChangedFcn<\/span> has two required input arguments: the figure handle and the <span style=\"font-family: monospace\">ThemeChangedData<\/span>, both of which provide access to the figure\u2019s current theme. If the callback function does not use the <span style=\"font-family: monospace\">ThemeChangedData<\/span>, the function can be called directly during the chart setup or from within the app\u2019s startup function. This is demonstrated in the <span style=\"font-family: monospace\">ThemeChangedFcn<\/span> demo above. <span style=\"font-family: monospace\">updateManualColors(fig,[],__)<\/span><\/li>\r\n \t<li style=\"margin-left: 56px;line-height: 21px;min-height: 0px;text-align: left\"><span style=\"font-weight: bold\">Trigger the <\/span><span style=\"font-weight: bold;font-family: monospace\">ThemeChangedFcn<\/span>: Use this when the <span style=\"font-family: monospace\">ThemeChangedData<\/span> is required. During setup or within an app\u2019s startup function, change the figure\u2019s theme, define the figure\u2019s <span style=\"font-family: monospace\">ThemeChangedFcn<\/span>, and use a <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/oncleanup.html\" target=\"_blank\" rel=\"noopener\">cleanup object<\/a> to revert the figure\u2019s <span style=\"font-family: monospace\">ThemeMode<\/span> to <span style=\"font-family: monospace\">\"auto\"<\/span>. Just before setup is complete, the cleanup object will revert the temporary theme change which will trigger the <span style=\"font-family: monospace\">ThemeChangedFcn<\/span>. Here\u2019s what that would look like in the setup method:<\/li>\r\n<\/ol>\r\n<div class=\"preformatted-matlab\" style=\"margin: 10px 3px 10px 55px;padding: 10px 10px 10px 5px\">\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #008013\">% revert theme to auto and trigger ThemeChangedFcn upon exiting setup<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">returnInitialTheme = onCleanup(@() theme(fig, <span style=\"color: #a709f5\">\"auto\"<\/span>));<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #008013\">% temporary theme change<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">initialTheme = fig.Theme;<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #0e00ff\">if<\/span> initialTheme.BaseColorStyle ==<span style=\"color: #a709f5\"> \"dark\"<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">\u00a0\u00a0\u00a0\u00a0theme(fig,<span style=\"color: #a709f5\"> \"light\"<\/span>)<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #0e00ff\">else<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">\u00a0\u00a0\u00a0\u00a0theme(fig, <span style=\"color: #a709f5\">\"dark\"<\/span>)<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #0e00ff\">end<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #008013\">% define ThemeChangedFcn<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">fig.ThemeChangedFcn = @updateManualColors;<\/div>\r\n<\/div>\r\n<h4 style=\"margin: 10px 10px 5px 4px;padding: 0px;line-height: 18px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 15px;font-weight: bold;text-align: left\"><span style=\"font-weight: bold;font-family: monospace\">getTheme<\/span><span style=\"font-weight: bold\">: for chart classes created using <\/span><span style=\"font-weight: bold;font-family: monospace\">ChartContainer<\/span> <span style=\"font-weight: bold\">and UI components created using <\/span><span style=\"font-weight: bold;font-family: monospace\">ComponentContainer<\/span><\/h4>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">The <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/matlab.graphics.chartcontainer.chartcontainer-class.html?searchHighlight=chartcontainer&amp;s_tid=srchtitle_support_results_1_chartcontainer\" target=\"_blank\" rel=\"noopener\"><span style=\"font-family: monospace\">matlab.graphics.chartcontainer.ChartContainer<\/span><\/a> and <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/matlab.ui.componentcontainer.componentcontainer-class.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-family: monospace\">matlab.ui.componentcontainer.ComponentContainer<\/span><\/a> classes are used to create advanced chart objects and custom UI components. These container classes provide an <span style=\"font-family: monospace\">update<\/span> method that is invoked when the chart's theme changes. As a result, there is no need to use the <span style=\"font-family: monospace\">ThemeChangedFcn<\/span> callback when working with classes derived from <span style=\"font-family: monospace\">ChartContainer<\/span> or <span style=\"font-family: monospace\">ComponentContainer<\/span>. Instead, use the <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/matlab.graphics.chartcontainer.chartcontainer.gettheme.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-family: monospace\">getTheme<\/span><\/a> method within the update method to obtain the figure's <span style=\"font-family: monospace\">GraphicsTheme<\/span> object. As described in the previous section, the <span style=\"font-family: monospace\">GraphicsTheme<\/span> object contains a <span style=\"font-family: monospace\">BaseColorStyle<\/span> property indicating the chart's current theme. The update method is also called after the <span style=\"font-family: monospace\">setup<\/span> method which allows for color management at initialization and during any subsequent theme changes.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">The methods block below contains snippets from the <span style=\"font-family: monospace\">setup<\/span> and <span style=\"font-family: monospace\">update<\/span> methods of a <span style=\"font-family: monospace\">SphericalLissajousCurve<\/span> class I created to demonstrate color management for a surface, line, and scatter object that supports both light and dark themes (see the full file: <a href=\"https:\/\/raw.githubusercontent.com\/MATLAB-Graphics-and-App-Building\/matlab-gaab-blog-2025\/refs\/heads\/main\/GuideToThemesForChartAppAuthors\/SphericalLissajousCurve.m\" target=\"_blank\" rel=\"noopener\">SphericalLissajousCurve.m<\/a>). A spherical Lissajous curve provides uniform and symmetric coverage over a sphere and is used in fields like satellite scanning and orbital mechanics where dark theme may come in handy.<\/div>\r\n<ul style=\"margin: 10px 0px 20px;padding-left: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-size: 14px\">\r\n \t<li style=\"margin-left: 56px;line-height: 21px;min-height: 0px;text-align: left\">The <span style=\"font-weight: bold;font-family: monospace\">setup<\/span> method initializes the surface, line, and scatter objects and sets properties that do not depend on the theme such as line width and transparency.<\/li>\r\n \t<li style=\"margin-left: 56px;line-height: 21px;min-height: 0px;text-align: left\">The <span style=\"font-weight: bold;font-family: monospace\">update<\/span> method calls a helper function, <span style=\"font-weight: bold;font-family: monospace\">updateColor<\/span>, which manages the color assignments based on the current theme.<\/li>\r\n \t<li style=\"margin-left: 56px;line-height: 21px;min-height: 0px;text-align: left\">Two sets of colors are defined--one for light theme and one for dark theme.<\/li>\r\n<\/ul>\r\n<div class=\"preformatted-matlab\" style=\"margin: 10px 3px 10px 55px;padding: 10px 10px 10px 5px\">\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">methods(Access = protected)<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #0e00ff\">function<\/span> setup(obj)<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #008013\">% ...<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">obj.SphereSurf = surf(___, FaceAlpha=0.4, EdgeAlpha=0.3);<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">obj.LissajousCurve = plot3(___, LineWidth=2);<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">obj.IntersectionPoints = scatter3(___, MarkerEdgeColor=<span style=\"color: #a709f5\">\"none\"<\/span>);<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #0e00ff\">end<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #0e00ff\">function<\/span> update(obj)<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #008013\">% ...<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">updateColor(obj);<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #0e00ff\">end<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #0e00ff\">function<\/span> updateColor(obj)<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">thm = getTheme(obj);<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #0e00ff\">switch<\/span> thm.BaseColorStyle<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">\u00a0\u00a0\u00a0\u00a0<span style=\"color: #0e00ff\">case<\/span> <span style=\"color: #a709f5\">\"light\"<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0obj.SphereSurf.FaceColor = [0.4 0.4 0.4];<span style=\"color: #008013\"> % darker gray<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0obj.LissajousCurve.Color = [0.53 0.80 0.92]; <span style=\"color: #008013\">% sky blue<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0obj.IntersectionPoints.MarkerFaceColor = [0 0 0.5]; <span style=\"color: #008013\">% Navy blue<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">\u00a0\u00a0\u00a0\u00a0<span style=\"color: #0e00ff\">case<\/span><span style=\"color: #a709f5\"> \"dark\"<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0obj.SphereSurf.FaceColor = [0.67 0.67 0.67];<span style=\"color: #008013\"> % lighter gray<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0obj.LissajousCurve.Color = [0 0.3 0.43];<span style=\"color: #008013\"> % dark blue<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0obj.IntersectionPoints.MarkerFaceColor = [0.8 0.87 1]; <span style=\"color: #008013\">% light blue<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #0e00ff\">end<\/span><\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\"><span style=\"color: #0e00ff\">end<\/span><\/div>\r\n<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">The Lissajous curve is produced with harmonic frequencies defined by m1 and m2 and a phase rotation defined by alpha. My default graphics theme is light, so the colors I chose for light theme are applied during setup. Applying dark theme after the chart is created invokes the chart's update method which assigns the colors I chose for dark theme to the sphere, line, and scatter objects.<\/div>\r\n<div class=\"preformatted-matlab\" style=\"margin: 10px 3px 10px 55px;padding: 10px 10px 10px 5px\">\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">S = SphericalLissajousCurve(m1=6, m2=7, alpha=0.07)<\/div>\r\n<div style=\"border-radius: 0px;padding: 0px;line-height: 15.6px;min-height: 16px;font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;font-size: 12px\">theme <span style=\"color: #a709f5\">dark<\/span><\/div>\r\n<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline;width: 821px;height: 540px\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/07\/aGuideToThemes.mlx-07-21-25_5.png\" alt=\"\" width=\"821\" height=\"540\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-style: italic\">Colors manually set in the chart's update method for each theme<\/span><\/div>\r\n<h2 style=\"margin: 3px 10px 5px 4px;padding: 0px;line-height: 25px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 20px;font-weight: bold;text-align: left\">3. Choosing color pairs<\/h2>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\">Selecting effective color pairs for light and dark themes can be challenging. To assist, R2025a introduces the <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/fliplightness.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-family: monospace\">fliplightness<\/span><\/a> tool. This function converts RGB triplets, or color arrays by inverting lightness while maintaining hue. For example, dark blue becomes light blue and light green becomes dark green. The logo below on the left is a Truecolor array that was converted using <span style=\"font-family: monospace\">fliplightness<\/span> to produce the version on the right. Let us know if you\u2019d like to learn more about this function.<\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><img decoding=\"async\" loading=\"lazy\" class=\"imageNode\" style=\"vertical-align: baseline;width: 282px;height: 136px\" src=\"http:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/07\/aGuideToThemes.mlx-07-21-25_6.png\" alt=\"\" width=\"282\" height=\"136\" \/><\/div>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><span style=\"font-style: italic\">The original logo (left) was converted using <\/span><span style=\"font-style: italic;font-family: monospace\">fliplightness<\/span><span style=\"font-style: italic\"> (right)<\/span><\/div>\r\n<h4 style=\"margin: 10px 10px 5px 4px;padding: 0px;line-height: 18px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 15px;font-weight: bold;text-align: left\"><span style=\"font-weight: bold\">Additional resources<\/span><\/h4>\r\n<ul style=\"margin: 10px 0px 20px;padding-left: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-size: 14px\">\r\n \t<li style=\"margin-left: 56px;line-height: 21px;min-height: 0px;text-align: left\"><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/creating_plots\/graphics-and-app-themes.html\" target=\"_blank\" rel=\"noopener\">Graphics and App Themes<\/a><\/li>\r\n \t<li style=\"margin-left: 56px;line-height: 21px;min-height: 0px;text-align: left\"><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/creating_plots\/design-graphics-and-apps-for-different-themes.html\" target=\"_blank\" rel=\"noopener\">Design Graphic and Apps for Different Themes<\/a><\/li>\r\n \t<li style=\"margin-left: 56px;line-height: 21px;min-height: 0px;text-align: left\"><a href=\"https:\/\/www.mathworks.com\/help\/matlab\/creating_guis\/create-app-that-updates-based-on-theme.html\" target=\"_blank\" rel=\"noopener\">Create App That Updates Based on Theme<\/a><\/li>\r\n<\/ul>\r\n<div style=\"margin: 2px 10px 9px 4px;padding: 0px;line-height: 21px;min-height: 0px;font-family: Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-style: normal;font-size: 14px;font-weight: 400;text-align: left\"><\/div>\r\n&nbsp;\r\n\r\n<\/div>\r\n<script type=\"text\/javascript\">\r\n{ let css = '';\r\nlet head = document.head || document.getElementsByTagName('head')[0];\r\nlet style = document.createElement('style');\r\nhead.appendChild(style);\r\nstyle.type = 'text\/css';\r\nif (style.styleSheet) {\r\n    style.styleSheet.cssText = css;\r\n} else {\r\n    style.appendChild(document.createTextNode(css));\r\n}\r\n\r\n\r\n}<\/script>","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/graphics-and-apps\/files\/2025\/07\/ThemeGuide_0_cover.png\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div><p>\r\nThe long-awaited dark theme is now available in MATLAB R2025a. This article serves as a guide for designing charts and apps in a specific theme or that adapt automatically to either theme. By... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/graphics-and-apps\/2025\/07\/22\/a-guide-to-themes-for-chart-creators-and-app-builders\/\">read more >><\/a><\/p>","protected":false},"author":198,"featured_media":3050,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,14,11,2,20],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/posts\/3041"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/users\/198"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/comments?post=3041"}],"version-history":[{"count":10,"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/posts\/3041\/revisions"}],"predecessor-version":[{"id":3071,"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/posts\/3041\/revisions\/3071"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/media\/3050"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/media?parent=3041"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/categories?post=3041"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/graphics-and-apps\/wp-json\/wp\/v2\/tags?post=3041"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}