Skip to content

Support theme-aware image variants, SVG images, and guidance for image creation - #3518

Merged
borland merged 7 commits into
mainfrom
si/update-kubernetes-diagrams
Nov 20, 2026
Merged

borland merged 7 commits into
mainfrom
si/update-kubernetes-diagrams

Conversation

@samironsoctopus

@samironsoctopus samironsoctopus commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This is a combination PR from @samironsoctopus and @borland

  • Adds support for SVG images
  • Adds support for dark-themed image variants
  • Updates two images in the kubernetes steps area to serve as examples
  • Provides guidance in README.md to help people create high quality images that follow the theme.

SVG sizing

  • SVGs inside a figure now fill the content column (figure img[src$='.svg'] { width: 100%; }), because they scale without losing sharpness. This also widens high-availability.svg slightly, from 800px to the column width. The other existing SVG figures were already column-width.
  • The zoom lightbox in src/scripts/modules/figures.js no longer limits vector images to their exported width. PNG and JPG keep the existing limit.

Themed Image Variants

  • The :img directive now has a src-dark attribute. It can now be used like this:
:img{src=".../load-balancer-light.svg" src-dark=".../load-balancer-dark.svg" alt="A load balancer"}
  • If you specify src-dark then the docs build process produces an HTML <picture> which wraps both the light and dark variants and uses CSS media queries to select which one is loaded.
  • Client-side JavaScript runs to override the media query if the user has used the theme-toggle button to pick the light them when their OS/System is in dark mode, or vice versa.

Like this:

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="…-dark.svg" data-theme-variant="dark">
  <img src="…-light.svg" alt="…" width="…" height="…">
</picture>

Note: If the user's browser matches their docs theme preference, then the <picture> plus CSS media query does its job, and the user's browser will only download the variant that they will see.
If they've overridden the OS default, then the browser ends up downloading both variants. I've used claude and done quite a bit of manual testing; there is no flicker or visible artifacting on any of Chrome/Edge/Firefox/Safari, it's just a bit of wasted bandwidth. FIxing this properly was really tricky, we would have needed much more complicated JS which would have increased the risk of breakage and I did not take that as a good tradeoff.

@team-marketing-branch-protections

Copy link
Copy Markdown

Pull request environment is available at https://stoctodocspr3518.z22.web.core.windows.net/.

You can view the ephemeral environment status in Octopus Deploy.

This environment will be automatically deprovisioned when the pull request is closed, or after 7 days of inactivity.

@samironsoctopus
samironsoctopus requested review from KMajkrzakOctopus, enf0rc3 and mattallford and removed request for KMajkrzakOctopus October 19, 2026 00:33
Comment thread README.md Resolved
Comment thread README.md Resolved
samironsoctopus and others added 7 commits November 20, 2026 13:05
Replace the Deploy Container and Load Balancer diagrams with Figma
exports in light and dark variants. Images marked theme-light-only or
theme-dark-only are hidden by the html[data-theme] attribute, so the
swap follows the site's theme toggle as well as the OS setting.

SVG figures now fill the content column, and the zoom lightbox no
longer caps vector images at their exported width.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace both diagrams with revised Figma exports, and update the
Deploy Container figure's width and height to the new 480x270 size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add guidance to the README on deciding whether a page needs a
screenshot, sizing PNGs and SVGs for the content column, creating
clear images, and adding light and dark variants with the
theme-light-only and theme-dark-only classes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SVG files are markup, not prose, so cspell flags attribute names such
as stroke-dasharray. Diagram labels exported from Figma are outlined
paths, so there's no text in them to check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The :img directive rewrote every image to a /docs/i/ path, but img.mjs only
generates variants for raster images, so an SVG pointed at a file that never
existed. It also dropped resp-img whenever a class was set.

SVGs now keep their own path and take their width and height from the file,
and an @2x image shows at half its pixel size. The Kubernetes diagrams and the
README guidance use the directive instead of raw <img> tags, so sizes no
longer have to be set by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Support a src-dark attribute on the :img directive so images can switch
  with the site theme
- Stop the zoom view fetching the hidden themed variant
- Separate the commented-out lists with blank lines for markdownlint

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@borland
borland force-pushed the si/update-kubernetes-diagrams branch from d8a3178 to 6ac6c2a Compare November 20, 2026 03:20
@borland borland changed the title Add themed Kubernetes diagrams and image contribution guidance Support theme-aware image variants, SVG images, and guidance for image creation Nov 20, 2026

@borland borland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed this with Sam who is happy for me to merge it

@borland
borland merged commit fa315ee into main Nov 20, 2026
7 checks passed
@borland
borland deleted the si/update-kubernetes-diagrams branch November 20, 2026 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants