<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Reverse colors in dark mode in Administration &amp; Architecture</title>
    <link>https://community.databricks.com/t5/administration-architecture/reverse-colors-in-dark-mode/m-p/144811#M4753</link>
    <description>&lt;P&gt;Also struggled with that issue. What I found is that there is a style applied onto the iframe: "filter: var(--invert-filter);" which applies this CSS: &lt;STRONG&gt;filter:&amp;nbsp;invert(1) saturate(0.5)&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;I couldn't find any elements within the iframe that I can use to detect if dark mode is on or not. But since most people use system settings detection to use dark mode or light mode, the simplest way I found is this - in order to invert colors back to normal we apply filter: invert(1) again, and add saturate(2) to up the saturation back from saturate(0.5). Add this script anywhere within the HTML &amp;lt;head&amp;gt; or &amp;lt;body&amp;gt; it will invert the colors back to normal if the user's system prefers dark mode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;script&amp;gt;
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
  document.firstChild.style.setProperty("filter", "invert(1) saturate(2)", "important")
}
&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alternatively, there is dark/light mode switch in the top right corner of the HTML rendering (sun/moon icon), that will get you back to regular view without inverting, but the user has to toggle it manually.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="valentin9_0-1769027125267.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/23195i3FC4B87BC69D4F15/image-size/medium?v=v2&amp;amp;px=400" role="button" title="valentin9_0-1769027125267.png" alt="valentin9_0-1769027125267.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Jan 2026 20:25:52 GMT</pubDate>
    <dc:creator>valentin9</dc:creator>
    <dc:date>2026-01-21T20:25:52Z</dc:date>
    <item>
      <title>Reverse colors in dark mode</title>
      <link>https://community.databricks.com/t5/administration-architecture/reverse-colors-in-dark-mode/m-p/87992#M1716</link>
      <description>&lt;P&gt;It seems that Databricks implements its dark mode by applying the invert filter so that all colors are reversed. This is problematic if one wants to create some sort of html widget or rich output since this filter is passed down to the result of displayHTML.&amp;nbsp; Then your output can look good in either light mode or dark mode but not both.&lt;/P&gt;&lt;P&gt;Is there a way to circumvent this or detect whether the editor is in light or dark mode with javascript from within the output cell? Since the output of displayHTML is sandboxed inside an iframe I see no direct way to access parent classes or to negate them.&lt;/P&gt;&lt;P&gt;Example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;displayHTML('&amp;lt;div style="color: red;"&amp;gt;Hello&amp;lt;/div&amp;gt;')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This looks red in light mode but teal in dark mode. I've tried !important, filter: none,&amp;nbsp;&amp;nbsp;color-scheme: light; etc but nothing seems to work.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2024 11:54:38 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/reverse-colors-in-dark-mode/m-p/87992#M1716</guid>
      <dc:creator>dbrixr</dc:creator>
      <dc:date>2024-09-03T11:54:38Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse colors in dark mode</title>
      <link>https://community.databricks.com/t5/administration-architecture/reverse-colors-in-dark-mode/m-p/88742#M1719</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/105896"&gt;@dbrixr&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 12:02:34 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/reverse-colors-in-dark-mode/m-p/88742#M1719</guid>
      <dc:creator>Anushree_Tatode</dc:creator>
      <dc:date>2024-09-11T12:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse colors in dark mode</title>
      <link>https://community.databricks.com/t5/administration-architecture/reverse-colors-in-dark-mode/m-p/89280#M1745</link>
      <description>&lt;P&gt;Huh? This has nothing to do with my question.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2024 11:36:32 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/reverse-colors-in-dark-mode/m-p/89280#M1745</guid>
      <dc:creator>dbrixr</dc:creator>
      <dc:date>2024-09-10T11:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse colors in dark mode</title>
      <link>https://community.databricks.com/t5/administration-architecture/reverse-colors-in-dark-mode/m-p/144811#M4753</link>
      <description>&lt;P&gt;Also struggled with that issue. What I found is that there is a style applied onto the iframe: "filter: var(--invert-filter);" which applies this CSS: &lt;STRONG&gt;filter:&amp;nbsp;invert(1) saturate(0.5)&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;I couldn't find any elements within the iframe that I can use to detect if dark mode is on or not. But since most people use system settings detection to use dark mode or light mode, the simplest way I found is this - in order to invert colors back to normal we apply filter: invert(1) again, and add saturate(2) to up the saturation back from saturate(0.5). Add this script anywhere within the HTML &amp;lt;head&amp;gt; or &amp;lt;body&amp;gt; it will invert the colors back to normal if the user's system prefers dark mode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;script&amp;gt;
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
  document.firstChild.style.setProperty("filter", "invert(1) saturate(2)", "important")
}
&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alternatively, there is dark/light mode switch in the top right corner of the HTML rendering (sun/moon icon), that will get you back to regular view without inverting, but the user has to toggle it manually.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="valentin9_0-1769027125267.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/23195i3FC4B87BC69D4F15/image-size/medium?v=v2&amp;amp;px=400" role="button" title="valentin9_0-1769027125267.png" alt="valentin9_0-1769027125267.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jan 2026 20:25:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/administration-architecture/reverse-colors-in-dark-mode/m-p/144811#M4753</guid>
      <dc:creator>valentin9</dc:creator>
      <dc:date>2026-01-21T20:25:52Z</dc:date>
    </item>
  </channel>
</rss>

