René's URL Explorer Experiment


Title: Set CSS value in HTML to reflect current theme · Issue #192 · python/python-docs-theme · GitHub

Open Graph Title: Set CSS value in HTML to reflect current theme · Issue #192 · python/python-docs-theme

X Title: Set CSS value in HTML to reflect current theme · Issue #192 · python/python-docs-theme

Description: See this page, where the anchor points to an SVG. If you ensure that there's no theme in local storage for this page, then if the browser settings are used to switch between dark and light modes (I'm using Firefox), the SVG is styled app...

Open Graph Description: See this page, where the anchor points to an SVG. If you ensure that there's no theme in local storage for this page, then if the browser settings are used to switch between dark and light modes (I...

X Description: See this page, where the anchor points to an SVG. If you ensure that there's no theme in local storage for this page, then if the browser settings are used to switch between dark and light mode...

Opengraph URL: https://github.com/python/python-docs-theme/issues/192

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Set CSS value in HTML to reflect current theme","articleBody":"See [this page](https://docs.python.org/3/howto/logging.html#logging-flow), where the anchor points to an SVG. If you ensure that there's no theme in local storage for this page, then if the browser settings are used to switch between dark and light modes (I'm using Firefox), the SVG is styled appropriately to display correctly. However, if I use the theme selector on the page to select dark mode when the browser is set to light mode, the SVG does not display correctly.\n\nThe reason is that I style for light mode and use a media query to override some styles, using `@media (prefers-color-scheme: dark)`. However, when the theme selector is used to select dark mode, then some dark-mode CSS is pulled in using the `activateTheme()` JS function, but from what I can tell this leaves no trace in the markup that we're now in dark mode. If there were e.g. a `dark-theme` class added to the `\u003cbody\u003e` tag when the page is in dark mode, then I could duplicate the styling using an appropriate selector. My complete styling of the SVG is:\n```css\n    svg {\n      background-color: transparent !important;\n    }\n    line {\n      stroke: #000000;\n      fill: none;\n      stroke-opacity: 1;\n    }\n    polygon, rect {\n      fill: none;\n      stroke: #000000;\n      fill-opacity: 1;\n      stroke-opacity: 1;\n    }\n    polygon.filled {\n      fill: #ff0000;\n    }\n    polyline {\n      fill: none;\n      stroke-opacity: 1;\n      stroke: #000000;\n    }\n    text {\n      fill: #000000;\n      fill-opacity: 1;\n      stroke: none;\n      font-family: sans-serif;\n      font-style: normal;\n      font-weight: normal;\n      text-anchor: start;\n    }\n    @media (prefers-color-scheme: dark) { /* could duplicate this styling if body.dark-theme */\n      polygon, rect, polyline, line {\n        stroke: #ffffff;\n      }\n      text {\n        fill: #ffffff;\n      }\n    }\n```\nIf there is another approach I could use to achieve the desired result (proper styling of the SVG in all cases), please let me know. Otherwise, would you consider adding ` dark-theme` class to the `body` or other container tag so that I could try and achieve the desired result? Or have I missed somewhere where such a class has been added?\n","author":{"url":"https://github.com/vsajip","@type":"Person","name":"vsajip"},"datePublished":"2024-07-01T18:11:45.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":9},"url":"https://github.com/192/python-docs-theme/issues/192"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:53faa974-f752-8d03-a51f-318058a7f8f7
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC20C:32E262:2921B10:376C90D:69707313
html-safe-noncea352301824c951cfb80b59825eea613616927723744250804828216941fe5f7b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjBDOjMyRTI2MjoyOTIxQjEwOjM3NkM5MEQ6Njk3MDczMTMiLCJ2aXNpdG9yX2lkIjoiMTIwMjMyNTI1MjQ2MTMyNzEyMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacf37fd10f12fe6a241fc781fd7d2c6a13f23e7a5ee34f07d25be153f33c4fc733
hovercard-subject-tagissue:2384450017
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/python-docs-theme/192/issue_layout
twitter:imagehttps://opengraph.githubassets.com/20b24925030503163810c45a0af58de3d24fda8bb175268206e91c241c74ee32/python/python-docs-theme/issues/192
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/20b24925030503163810c45a0af58de3d24fda8bb175268206e91c241c74ee32/python/python-docs-theme/issues/192
og:image:altSee this page, where the anchor points to an SVG. If you ensure that there's no theme in local storage for this page, then if the browser settings are used to switch between dark and light modes (I...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamevsajip
hostnamegithub.com
expected-hostnamegithub.com
None9920a62ba22d06470388e2904804fb7e5ec51c9e35f81784e9191394c74b2bd2
turbo-cache-controlno-preview
go-importgithub.com/python/python-docs-theme git https://github.com/python/python-docs-theme.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id93341818
octolytics-dimension-repository_nwopython/python-docs-theme
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id93341818
octolytics-dimension-repository_network_root_nwopython/python-docs-theme
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release7d6181066430cc06553c8396ca201e194ae33cb9
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/python/python-docs-theme/issues/192#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fpython-docs-theme%2Fissues%2F192
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fpython-docs-theme%2Fissues%2F192
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fpython-docs-theme
Reloadhttps://patch-diff.githubusercontent.com/python/python-docs-theme/issues/192
Reloadhttps://patch-diff.githubusercontent.com/python/python-docs-theme/issues/192
Reloadhttps://patch-diff.githubusercontent.com/python/python-docs-theme/issues/192
python https://patch-diff.githubusercontent.com/python
python-docs-themehttps://patch-diff.githubusercontent.com/python/python-docs-theme
Please reload this pagehttps://patch-diff.githubusercontent.com/python/python-docs-theme/issues/192
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fpython%2Fpython-docs-theme
Fork 75 https://patch-diff.githubusercontent.com/login?return_to=%2Fpython%2Fpython-docs-theme
Star 84 https://patch-diff.githubusercontent.com/login?return_to=%2Fpython%2Fpython-docs-theme
Code https://patch-diff.githubusercontent.com/python/python-docs-theme
Issues 12 https://patch-diff.githubusercontent.com/python/python-docs-theme/issues
Pull requests 4 https://patch-diff.githubusercontent.com/python/python-docs-theme/pulls
Actions https://patch-diff.githubusercontent.com/python/python-docs-theme/actions
Projects 0 https://patch-diff.githubusercontent.com/python/python-docs-theme/projects
Security Uh oh! There was an error while loading. Please reload this page. https://patch-diff.githubusercontent.com/python/python-docs-theme/security
Please reload this pagehttps://patch-diff.githubusercontent.com/python/python-docs-theme/issues/192
Insights https://patch-diff.githubusercontent.com/python/python-docs-theme/pulse
Code https://patch-diff.githubusercontent.com/python/python-docs-theme
Issues https://patch-diff.githubusercontent.com/python/python-docs-theme/issues
Pull requests https://patch-diff.githubusercontent.com/python/python-docs-theme/pulls
Actions https://patch-diff.githubusercontent.com/python/python-docs-theme/actions
Projects https://patch-diff.githubusercontent.com/python/python-docs-theme/projects
Security https://patch-diff.githubusercontent.com/python/python-docs-theme/security
Insights https://patch-diff.githubusercontent.com/python/python-docs-theme/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/python/python-docs-theme/issues/192
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/python/python-docs-theme/issues/192
Set CSS value in HTML to reflect current themehttps://patch-diff.githubusercontent.com/python/python-docs-theme/issues/192#top
enhancementhttps://github.com/python/python-docs-theme/issues?q=state%3Aopen%20label%3A%22enhancement%22
help wantedhttps://github.com/python/python-docs-theme/issues?q=state%3Aopen%20label%3A%22help%20wanted%22
https://github.com/vsajip
https://github.com/vsajip
vsajiphttps://github.com/vsajip
on Jul 1, 2024https://github.com/python/python-docs-theme/issues/192#issue-2384450017
this pagehttps://docs.python.org/3/howto/logging.html#logging-flow
enhancementhttps://github.com/python/python-docs-theme/issues?q=state%3Aopen%20label%3A%22enhancement%22
help wantedhttps://github.com/python/python-docs-theme/issues?q=state%3Aopen%20label%3A%22help%20wanted%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.