<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Regime Map Team</title>
    <description>The latest articles on DEV Community by Regime Map Team (@regimemap).</description>
    <link>https://dev.to/regimemap</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4219604%2F46527701-b4db-448a-9bae-7e3308ccc744.png</url>
      <title>DEV Community: Regime Map Team</title>
      <link>https://dev.to/regimemap</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/regimemap"/>
    <language>en</language>
    <item>
      <title>A map that doesn't need colour: our embed in Windows forced-colors mode</title>
      <dc:creator>Regime Map Team</dc:creator>
      <pubDate>Wed, 04 Nov 2026 19:23:32 +0000</pubDate>
      <link>https://dev.to/regimemap/a-map-that-doesnt-need-colour-our-embed-in-windows-forced-colors-mode-41k5</link>
      <guid>https://dev.to/regimemap/a-map-that-doesnt-need-colour-our-embed-in-windows-forced-colors-mode-41k5</guid>
      <description>&lt;p&gt;We're the team behind Regime Map, a country-by-country register of gambling regulation. Our embeddable map colours each country by its regulatory status. A few days ago we wrote about &lt;a href="https://dev.to/regimemap/building-a-third-party-embed-that-survives-any-host-page-bk5"&gt;making that embed survive any host page&lt;/a&gt;. Under that post, a reader asked something we hadn't tested: what happens to the map in Windows forced-colors mode?&lt;/p&gt;

&lt;p&gt;The honest answer was that it broke. This post is how we fixed it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu6bxrjjsnv31hy2a9zwg.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu6bxrjjsnv31hy2a9zwg.gif" alt="The world map switching from normal colours to a dark, then a light, contrast theme." width="800" height="576"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What a contrast theme does to a map
&lt;/h2&gt;

&lt;p&gt;In a Windows contrast theme the browser repaints every page with a small palette of about eight system colours: one for the background, one for text, one for links, one for buttons, and so on. For text, that is exactly what a reader with low vision or light sensitivity wants.&lt;/p&gt;

&lt;p&gt;Our map has six statuses, each with its own fill: licensed regime, state monopoly, varies by region, prohibited, no licensing regime and not assessed, plus "not covered yet" for countries we haven't checked. The legend under the map is the key.&lt;/p&gt;

&lt;p&gt;In forced colours the legend lost its key: every swatch went blank, so the map was still coloured but nothing said which colour meant which status. And the map ignored the reader's theme: with the default embed code, in a dark contrast theme it sat on the page as a bright block of our own colours, exactly the glare the reader had switched the theme on to avoid. (An embed set to its dark theme kept its dark palette instead; its legend was just as blank.)&lt;/p&gt;

&lt;p&gt;Both have one cause. The browser repaints CSS backgrounds, so the swatches lost their colours. Chromium doesn't repaint SVG fills, so the map kept ours.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F65k3khefx8feo5eapxi0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F65k3khefx8feo5eapxi0.png" alt="The world map in a dark Windows contrast theme, before and after the 4 November 2026 update. Before: a bright block of the map's own colours, and a legend with no colour marks. After: black-and-white textures in the reader's theme colours, with the same textures in the legend." width="800" height="311"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Who sees it, and who turns it on
&lt;/h2&gt;

&lt;p&gt;Not us. A reader turns it on in Windows 10 or 11 (Settings → Accessibility → Contrast themes), and Edge, Chrome and Firefox all follow it. Firefox can also be set to override the colours a page specifies. macOS "Increase contrast" doesn't trigger it.&lt;/p&gt;

&lt;p&gt;The page sees a single media feature:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;forced-colors&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;active&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;/* … */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So there's no option in the embed code and nothing for a host site to configure. The script form and the iframe form behave the same: the embed follows the reader's system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Textures instead of colours
&lt;/h2&gt;

&lt;p&gt;The fix had to work inside the reader's theme: no colours of our own, only the system's handful, and that isn't enough for six statuses. So something other than colour has to carry the status. Each status got its own texture:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;status&lt;/th&gt;
&lt;th&gt;texture&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Licensed regime&lt;/td&gt;
&lt;td&gt;solid&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;State monopoly&lt;/td&gt;
&lt;td&gt;dots&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Varies by region&lt;/td&gt;
&lt;td&gt;diagonal hatch&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Prohibited&lt;/td&gt;
&lt;td&gt;cross-hatch&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No licensing regime&lt;/td&gt;
&lt;td&gt;horizontal lines&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Not assessed&lt;/td&gt;
&lt;td&gt;vertical lines&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Not covered yet&lt;/td&gt;
&lt;td&gt;empty, dashed outline&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;On the map they're SVG &lt;code&gt;&amp;lt;pattern&amp;gt;&lt;/code&gt;s drawn in &lt;code&gt;CanvasText&lt;/code&gt; on &lt;code&gt;Canvas&lt;/code&gt;, so they invert correctly between dark and light themes. In the swatches, the same textures are CSS gradients. A lawful exception, such as pachinko halls in Japan's land-based gambling, keeps the asterisk pattern it already had, and it's spelled out in words in the tooltip, the table and the card.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwzciaq5vpmizryxsrmir.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwzciaq5vpmizryxsrmir.png" alt="The map legend in normal colours and in two contrast themes: seven statuses, seven textures." width="800" height="238"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is the "prohibited" pattern, slightly simplified (the renderer builds this markup as a JavaScript string and writes the transform at draw time). Two crossing bars, rotated 45°, give diagonal lines both ways:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;pattern id="rmefc-pro" width="6" height="6" patternUnits="userSpaceOnUse"
         patternTransform="rotate(45)"&amp;gt;
  &amp;lt;rect width="6" height="6" fill="Canvas"/&amp;gt;
  &amp;lt;rect width="1.25" height="6" fill="CanvasText"/&amp;gt;
  &amp;lt;rect width="6" height="1.25" fill="CanvasText"/&amp;gt;
&amp;lt;/pattern&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The system colours sit in presentation attributes, and one rule in the forced-colors block points each country at its pattern:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;forced-colors&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;active&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;.map&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;data-s&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nt"&gt;prohibited&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="py"&gt;fill&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;url&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="n"&gt;rmefc-pro&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="cp"&gt;!important&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  System colour keywords, and nothing else
&lt;/h2&gt;

&lt;p&gt;Inside the forced-colors block there are no hex values at all, only CSS system colour keywords:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;forced-colors&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;active&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c"&gt;/* Canvas, CanvasText, GrayText, Highlight,
     LinkText, ButtonFace, ButtonText. No hex. */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The reader's theme decides what those look like. In Chromium's dark emulated palette, &lt;code&gt;GrayText&lt;/code&gt; comes out green and links yellow; in the light one, &lt;code&gt;GrayText&lt;/code&gt; is dark red. We don't need to know. There is one such block per stylesheet: the map's, the card's, and the &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; fallback for browsers without constructable stylesheets.&lt;/p&gt;

&lt;h2&gt;
  
  
  Opting out, only where it's needed
&lt;/h2&gt;

&lt;p&gt;In forced-colors mode the browser takes over every colour by default, and for almost everything that's what we want: text, buttons, links, borders, the tooltip. We leave those alone.&lt;/p&gt;

&lt;p&gt;Two things opt out: the map's SVG, and the status swatch, one small element reused in the legend, the table, the tooltip, the bottom sheet, the search list and the card. These are the real rules, trimmed (sizes dropped, one of the six swatch textures shown; &lt;code&gt;.xsw&lt;/code&gt; is the legend's small asterisk key):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;forced-colors&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;active&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;.stage&lt;/span&gt; &lt;span class="nt"&gt;svg&lt;/span&gt;&lt;span class="nc"&gt;.map&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;.rme&lt;/span&gt; &lt;span class="nc"&gt;.xsw&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="py"&gt;forced-color-adjust&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nc"&gt;.rme&lt;/span&gt; &lt;span class="nc"&gt;.sw&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="py"&gt;forced-color-adjust&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="n"&gt;CanvasText&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Canvas&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nc"&gt;.rme&lt;/span&gt; &lt;span class="nc"&gt;.sw--prohibited&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;repeating-linear-gradient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;45deg&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;CanvasText&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;1.25px&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;transparent&lt;/span&gt; &lt;span class="m"&gt;1.25px&lt;/span&gt; &lt;span class="m"&gt;6px&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nf"&gt;repeating-linear-gradient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;135deg&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;CanvasText&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;1.25px&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;transparent&lt;/span&gt; &lt;span class="m"&gt;1.25px&lt;/span&gt; &lt;span class="m"&gt;6px&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;Canvas&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The swatches are tiny CSS boxes whose textures are background gradients, and forced colours removes background images, so without opting out they go blank. The map's SVG opts out too; in Chromium that turned out to be only a safeguard (its pattern fills survive either way), but other browsers treat SVG differently.&lt;/p&gt;

&lt;p&gt;Having opted out, they do the browser's job themselves: they draw only in system colours. Opting out and then painting in your own brand colours would undo the reader's theme.&lt;/p&gt;

&lt;p&gt;The rule from the first post still holds: there is no &lt;code&gt;style=""&lt;/code&gt; attribute anywhere, so a host with a strict &lt;code&gt;style-src-attr&lt;/code&gt; still renders the map. Sizes go through the CSSOM or SVG attributes, never a &lt;code&gt;style&lt;/code&gt; attribute, and the pattern tiles are rescaled at every zoom level so they stay 6 × 6 pixels on screen. This is the real line (ES5); &lt;code&gt;S&lt;/code&gt; is screen pixels per map unit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setAttribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;patternTransform&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;scale(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;S&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;)&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; rotate(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;)&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Bigger dots, focus in Highlight
&lt;/h2&gt;

&lt;p&gt;Under forced colours only, the small-state dots grow from a radius of 4 to 6 at world scale and get a &lt;code&gt;Canvas&lt;/code&gt; halo, so they stand out from the sea. Keyboard focus and the selected country are drawn in &lt;code&gt;Highlight&lt;/code&gt;, the colour the reader's theme uses for "this one".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwalcnn50iwwsswpudsg2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwalcnn50iwwsswpudsg2.png" alt="The Europe view in a dark Windows contrast theme, with small states drawn as larger textured dots." width="800" height="896"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If the reader switches a theme on or off with the page open, a &lt;code&gt;matchMedia('(forced-colors: active)')&lt;/code&gt; listener redraws the map.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two browser quirks
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A transparent border is forced visible.&lt;/strong&gt; Our inactive product tabs had &lt;code&gt;transparent&lt;/code&gt; bottom borders. In forced colours every tab grew an underline, and you couldn't tell which one was active. The inactive tabs now use a &lt;code&gt;Canvas&lt;/code&gt; border, which blends into the background as intended.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Chromium paints a "backplate" behind text.&lt;/strong&gt; In "Find a country", the active match had a filled background, and the backplate hid its own label. The active option is now an outline instead of a fill.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Testing without a Windows machine
&lt;/h2&gt;

&lt;p&gt;We tested in Chromium's forced-colours emulation, light and dark palettes. In Playwright:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;emulateMedia&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;forcedColors&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;active&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;colorScheme&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dark&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and the same with &lt;code&gt;colorScheme: 'light'&lt;/code&gt;. By hand, in Chrome: DevTools → Rendering → "Emulate CSS media feature forced-colors". Chromium's two emulated palettes are those of Windows' classic "High Contrast Black" and "High Contrast White"; the dark one is close to Windows 11's "Night sky".&lt;/p&gt;

&lt;p&gt;We went through 21 states in both palettes: the world map for two products, Europe with the small-state dots, zoomed in once and twice, the narrow product menu, search, a tooltip with an exception, the bottom sheet on a phone, keyboard focus on a country and on a dot, the table view, the credit bar, the country cards, and the iframe forms.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6f2mf4c9xs5szat7ohdw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6f2mf4c9xs5szat7ohdw.png" alt="The world map in a light Windows contrast theme, each status drawn as its own texture." width="799" height="576"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The other half of the test mattered as much: had we changed the normal look? We screenshotted the same 21 states, light and dark, with the old renderer and the new one, both on the same production data, and compared them pixel by pixel. 38 of the 42 pairs were identical. The four keyboard-focus states differed by 1,710 to 2,570 pixels of anti-aliasing along borders, and the old renderer compared with itself differs by the same amounts.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it cost
&lt;/h2&gt;

&lt;p&gt;1.7 KB gzipped for the map renderer and 0.4 KB for the card. The whole map (loader, renderer and data) is now about 47 KB gzipped, and a country card about 8.5 KB.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we haven't done yet
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A real Windows machine.&lt;/strong&gt; Everything above is emulation. Windows 11's other contrast themes (Aquatic, Desert, Dusk) use other colours. The textures, layout and wording stay the same, but we haven't seen them on the real thing. Nor have we tested Firefox's own "override the page's colours" setting.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The closest calls.&lt;/strong&gt; At world scale, a state-monopoly dot and a prohibited dot are four dots in a ring against an X in a ring: distinct, but small. A country only a few pixels across, like Luxembourg or Cyprus, has no room for a 5–6 px texture until you zoom in, as in the normal look. And "not covered yet" differs from the sea only by its outline.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you use a contrast theme, we'd like to hear what you see: in the comments, or at &lt;a href="mailto:support@regimemap.com"&gt;support@regimemap.com&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;The configurator, with a live preview of the map and the country cards, is at &lt;a href="https://regimemap.com/data-api/" rel="noopener noreferrer"&gt;regimemap.com/data-api&lt;/a&gt;. The &lt;a href="https://huggingface.co/spaces/regimemap/embeds" rel="noopener noreferrer"&gt;Hugging Face demo&lt;/a&gt; loads the live embed, so it already shows all of this: open it, turn on forced-colors emulation in DevTools and look.&lt;/p&gt;

&lt;p&gt;Last time we promised a post on counting embeds without logging the people who read them. That one comes next.&lt;/p&gt;

</description>
      <category>a11y</category>
      <category>css</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Building a third-party embed that survives any host page</title>
      <dc:creator>Regime Map Team</dc:creator>
      <pubDate>Sun, 01 Nov 2026 19:39:52 +0000</pubDate>
      <link>https://dev.to/regimemap/building-a-third-party-embed-that-survives-any-host-page-bk5</link>
      <guid>https://dev.to/regimemap/building-a-third-party-embed-that-survives-any-host-page-bk5</guid>
      <description>&lt;p&gt;We publish Regime Map, a country-by-country register of gambling regulation. The people who write about the subject, lawyers and journalists mostly, need the same picture we already draw: which countries license online casino and which don't. So we made the map embeddable. Paste a snippet, get the map.&lt;/p&gt;

&lt;p&gt;The hard part of a third-party embed isn't drawing the thing. It's that you ship code into pages you will never see. Somebody's WordPress theme sets &lt;code&gt;svg { max-width: 50% }&lt;/code&gt;. Somebody else's news site has a strict Content-Security-Policy. A third one is a React app that adds your element after your script has already run. And the reader on a cheap phone didn't ask for your 200 KB of JavaScript.&lt;/p&gt;

&lt;p&gt;This post is the list of decisions we made so the embed survives all of that, and so it can't damage the host page in return.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7hyxwx8ob3ezttdxm8le.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7hyxwx8ob3ezttdxm8le.png" alt="The map embed inside a (fictional) law firm's blog post" width="800" height="556"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The contract is the markup
&lt;/h2&gt;

&lt;p&gt;What a site pastes is the whole public interface:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;data-regimemap=&lt;/span&gt;&lt;span class="s"&gt;"map"&lt;/span&gt; &lt;span class="na"&gt;data-lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt; &lt;span class="na"&gt;data-region=&lt;/span&gt;&lt;span class="s"&gt;"world"&lt;/span&gt; &lt;span class="na"&gt;data-theme=&lt;/span&gt;&lt;span class="s"&gt;"light"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Interactive map: online casino regulation by country.&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Map: &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://regimemap.com/gambling-regulation-map/"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Regime Map&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;async&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://regimemap.com/embed/v1/embed.js"&lt;/span&gt; &lt;span class="na"&gt;referrerpolicy=&lt;/span&gt;&lt;span class="s"&gt;"no-referrer"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three rules follow from treating that as an API:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Everything lives under &lt;code&gt;/embed/v1/&lt;/code&gt;.&lt;/strong&gt; Inside v1, anything may change as long as pasted code keeps working. New options arrive as new &lt;code&gt;data-&lt;/code&gt; attributes with defaults. A breaking change would be &lt;code&gt;/embed/v2/&lt;/code&gt;, and v1 keeps running.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The text inside the &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; is the no-JavaScript fallback.&lt;/strong&gt; If the script is stripped or blocked, the reader still gets a sentence and the link below it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nothing ever goes blank.&lt;/strong&gt; If we retire the embed, or switch it off for one site, it renders a short card instead of an empty box.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Load almost nothing up front
&lt;/h2&gt;

&lt;p&gt;The script tag points at a loader of 2.6 KB gzipped. It does four things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Finds its own origin from &lt;code&gt;document.currentScript&lt;/code&gt;&lt;/strong&gt;, so the same file works in any environment with no configuration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reserves each embed's height straight away&lt;/strong&gt;, from the region's aspect ratio or a card's usual height, so the host page doesn't jump when the map arrives.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Waits for an &lt;code&gt;IntersectionObserver&lt;/code&gt; with a 200 px margin.&lt;/strong&gt; A map in the footer of a long article costs the reader 2.6 KB until they scroll near it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shares requests.&lt;/strong&gt; Two maps and three cards on one page fetch each file once. Pasting the script tag twice is harmless; the second copy just rescans.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Everything else is plain ES5 with no framework, no dependencies and no web fonts. The renderers get content-hashed names and a one-year immutable cache; the loader is cached for an hour and names the current pair. Translated strings travel in the per-language data file, not in the renderer, so one renderer serves all 39 languages and stays cacheable.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;piece&lt;/th&gt;
&lt;th&gt;gzipped&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;loader&lt;/td&gt;
&lt;td&gt;2.6 KB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;map renderer, including the world geometry&lt;/td&gt;
&lt;td&gt;40.9 KB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;map data, per language&lt;/td&gt;
&lt;td&gt;3.1–4.3 KB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;map, total&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;≈ 47 KB&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;country card, total&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;≈ 8.5 KB&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Updated 4 November 2026: since this post went out, the map has gained four more products, 32 more languages and forced-colours support. These are today's sizes.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Single-page apps get one global, &lt;code&gt;window.RegimeMapEmbed.scan()&lt;/code&gt;, to call after they insert an element. Each element mounts once; to change options you replace the element (in React, a new &lt;code&gt;key&lt;/code&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  Shadow DOM, but carefully
&lt;/h2&gt;

&lt;p&gt;Each embed renders into an open shadow root. That stops the host's selectors from matching our elements, but it does not stop &lt;strong&gt;inheritance&lt;/strong&gt;: &lt;code&gt;font&lt;/code&gt;, &lt;code&gt;color&lt;/code&gt;, &lt;code&gt;line-height&lt;/code&gt;, &lt;code&gt;letter-spacing&lt;/code&gt; and friends still flow in from the host. So the first rule is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nd"&gt;:host&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;all&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;initial&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;block&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and then the stylesheet sets every property it relies on, including &lt;code&gt;box-sizing&lt;/code&gt;. We tested against a page with deliberately hostile rules on &lt;code&gt;*&lt;/code&gt;, &lt;code&gt;div&lt;/code&gt;, &lt;code&gt;a&lt;/code&gt;, &lt;code&gt;table&lt;/code&gt;, &lt;code&gt;svg&lt;/code&gt; and &lt;code&gt;button&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Two details mattered more than we expected:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Styles arrive as a constructable stylesheet&lt;/strong&gt; (&lt;code&gt;adoptedStyleSheets&lt;/code&gt;). Where that API is missing, a &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; to a CSS file inside the shadow root takes over. Hosts with a strict &lt;code&gt;style-src&lt;/code&gt; then only need to allow our origin.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;There is no &lt;code&gt;style=""&lt;/code&gt; attribute anywhere in the output.&lt;/strong&gt; Sizes are set through the CSSOM instead. A host with &lt;code&gt;style-src-attr 'none'&lt;/code&gt; still renders the embed. Inline style attributes are the first thing a strict policy kills, and they're easy to add without noticing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Under a strict CSP the script form needs our origin in &lt;code&gt;script-src&lt;/code&gt; and &lt;code&gt;connect-src&lt;/code&gt; (plus &lt;code&gt;style-src&lt;/code&gt; for the fallback path). The iframe form needs &lt;code&gt;frame-src&lt;/code&gt;. That's it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq8opffd3qh6wafrw1l1t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq8opffd3qh6wafrw1l1t.png" alt="The same embed in a dark newsletter theme, zoomed to Europe" width="800" height="556"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Credit without touching the host page
&lt;/h2&gt;

&lt;p&gt;The embed is free. The one condition is a visible credit line under it, and that line is the host's own HTML, outside anything we render. The host may add &lt;code&gt;rel="nofollow"&lt;/code&gt; to it, and the terms say so plainly.&lt;/p&gt;

&lt;p&gt;The embed checks for it: a visible link to our domain in its parent element or one of the next two siblings. A hidden or zero-opacity link doesn't count. If there is none, the embed draws its own credit bar &lt;strong&gt;inside its own frame&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;What it never does is inject a link into the host page. A widget that adds links to other people's pages from JavaScript is exactly what search engines describe as link spam, and it would also be rude. Every link the embed renders itself opens in a new tab with &lt;code&gt;rel="nofollow noopener"&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  When scripts aren't allowed
&lt;/h2&gt;

&lt;p&gt;Plenty of platforms strip &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt;. For those there is an iframe form with the same options as query parameters. Two lessons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Iframe height has no good answer without &lt;code&gt;postMessage&lt;/code&gt; resizing,&lt;/strong&gt; which we chose not to depend on. The map frame keeps a 16:10 ratio with a 420 px minimum, because at 320 px wide 16:10 alone is too short for the header, map and legend. Country cards get a fixed height that the configurator measures for that country and language at 360 px, so a phone never cuts them off.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Some platforms take neither scripts nor iframes,&lt;/strong&gt; Medium and Substack among them. There the honest answer is a screenshot with a caption that credits and links the source.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Switching off one site without naming it
&lt;/h2&gt;

&lt;p&gt;Sometimes an embed shows up somewhere it shouldn't. Every data file carries an &lt;code&gt;off&lt;/code&gt; list of 32-bit FNV-1a hashes of hostnames (lower case, without &lt;code&gt;www.&lt;/code&gt;). The embed hashes its own host, or an iframe's parent, and on a match shows "not available on this site" with no link.&lt;/p&gt;

&lt;p&gt;Hashes, so the public file doesn't list anyone. And FNV-1a rather than SHA-256 because &lt;code&gt;crypto.subtle&lt;/code&gt; only exists in secure contexts, and plenty of host pages are still plain http. The change reaches every embed within the hour, which is the data file's cache time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Accessibility is part of "survives"
&lt;/h2&gt;

&lt;p&gt;A map that only works with a mouse doesn't survive a keyboard user. The SVG is &lt;code&gt;aria-hidden&lt;/code&gt; and a sentence summarises it. The map is one tab stop with a roving tabindex: arrow keys move from country to country, Home and End jump to the ends, Enter goes to the country's link, Esc closes. There's a full &lt;strong&gt;table view&lt;/strong&gt;. Touch targets are 44 px, and small states are drawn as dots so they can be found and tapped at world scale. &lt;code&gt;prefers-reduced-motion&lt;/code&gt; removes the transitions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgv3gh1vgptpmom5g6fli.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgv3gh1vgptpmom5g6fli.png" alt="The accessible table view" width="800" height="670"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update, 4 November 2026.&lt;/strong&gt; A reader asked under this post how the map copes with Windows contrast themes. Not well, it turned out. The legend's swatches went blank, so nothing told you which colour meant which status. And with the default embed code the map kept our own colours, which left a bright block sitting in a dark theme. Since then every status has its own texture, drawn in the reader's system colours. The small-state dots are bigger, and keyboard focus uses the system &lt;code&gt;Highlight&lt;/code&gt; colour. So far we have only tested this in Chromium's forced-colours emulation, with both the light and the dark palette, and not yet on a real Windows machine. How we did it is in a separate post: &lt;a href="https://dev.to/regimemap/a-map-that-doesnt-need-colour-our-embed-in-windows-forced-colors-mode-41k5"&gt;A map that doesn't need colour&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fld2lbmh1nl7h9m0nwdgn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fld2lbmh1nl7h9m0nwdgn.png" alt="The same Regime Map world map twice: in normal colours, and in a dark Windows contrast theme where each status is drawn as a black-and-white texture." width="800" height="311"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The short version
&lt;/h2&gt;

&lt;p&gt;Squeezed into a paragraph, this post says: the snippet people paste is an API, so the sentence inside the &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; has to make sense on its own for the day the script never runs. Our loader is 2.6 KB gzipped, and the first thing it does is reserve the height, before it fetches anything else. In the shadow root we start from &lt;code&gt;:host { all: initial }&lt;/code&gt;, since fonts and colours still get in through inheritance. There isn't a single &lt;code&gt;style&lt;/code&gt; attribute in there either. A constructable stylesheet does that job, with a &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; fallback for browsers that lack it.&lt;/p&gt;

&lt;p&gt;Everything else is about manners. We don't touch the host page, and that includes our own credit link. If a platform strips scripts, it gets the iframe. Medium and Substack take neither, and we'd rather say so than pretend. When one site misbehaves, we can switch it off by its hostname hash, and the public file still names nobody. Keyboard navigation, the table view and a forced-colours pass should ship in version one. We added the last one late, after a reader asked, even though DevTools emulates forced colours in about a minute.&lt;/p&gt;

&lt;p&gt;The configurator, with a live preview of the map and the country cards, is at &lt;a href="https://regimemap.com/data-api/" rel="noopener noreferrer"&gt;regimemap.com/data-api&lt;/a&gt;. How we count where the embed appears without logging the people who read it deserves its own post; that's next.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>css</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
