Shopify.theme is the primary source
The storefront HTML includes a Shopify.theme object with the theme name, ID, schema name, schema version, Theme Store ID, and role. Because it is rendered server-side, it is present even when the page is served from a cache.