Skip to content

Commit

Permalink
Added style for prefers-color-scheme to interstitial head (#1935)
Browse files Browse the repository at this point in the history
* Added style for prefers-color-scheme to interstitial head

This checks if the user prefers dark color schemes, and then sets the body to black. This could reduce 'flashes of white'.

* feat(backend): Added prefers-color-scheme to interstitial
  • Loading branch information
royanger authored Oct 31, 2023
1 parent bdfd27b commit 8b6b094
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/flat-pots-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/backend': minor
---

Added prefers-color-scheme to interstitial
7 changes: 7 additions & 0 deletions packages/backend/src/tokens/interstitial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ export function loadInterstitialFromLocal(options: Omit<LoadInterstitialOptions,
return `
<head>
<meta charset="UTF-8" />
<style>
@media (prefers-color-scheme: dark) {
body {
background-color: black;
}
}
</style>
</head>
<body>
<script>
Expand Down

0 comments on commit 8b6b094

Please sign in to comment.