Skip to content

Commit

Permalink
Rely on iframe content to set html color-scheme based on theme
Browse files Browse the repository at this point in the history
  • Loading branch information
laymonage committed Nov 6, 2022
1 parent 946b5d0 commit 0a315b0
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 27 deletions.
1 change: 0 additions & 1 deletion client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@
.giscus-frame {
border: none;
color-scheme: normal;
}
`;
document.head.prepend(style);
Expand Down
6 changes: 4 additions & 2 deletions styles/themes/custom_example.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
* https://github.com/primer/primitives/blob/main/LICENSE
*/

html {
color-scheme: dark;
}

main {
--color-prettylights-syntax-comment: #768390;
--color-prettylights-syntax-constant: #6cb6ff;
Expand Down Expand Up @@ -84,8 +88,6 @@ main {
/*! Extensions from @primer/css/alerts/flash.scss */
--color-social-reaction-bg-hover: var(--color-scale-gray-7);
--color-social-reaction-bg-reacted-hover: var(--color-scale-blue-8);

color-scheme: dark;
}

main .pagination-loader-container {
Expand Down
6 changes: 4 additions & 2 deletions styles/themes/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
* https://github.com/primer/primitives/blob/main/LICENSE
*/

html {
color-scheme: dark;
}

main {
--color-prettylights-syntax-comment: #8b949e;
--color-prettylights-syntax-constant: #79c0ff;
Expand Down Expand Up @@ -83,8 +87,6 @@ main {
/*! Extensions from @primer/css/alerts/flash.scss */
--color-social-reaction-bg-hover: var(--color-scale-gray-7);
--color-social-reaction-bg-reacted-hover: var(--color-scale-blue-8);

color-scheme: dark;
}

main .pagination-loader-container {
Expand Down
6 changes: 4 additions & 2 deletions styles/themes/dark_dimmed.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
* https://github.com/primer/primitives/blob/main/LICENSE
*/

html {
color-scheme: dark;
}

main {
--color-prettylights-syntax-comment: #768390;
--color-prettylights-syntax-constant: #6cb6ff;
Expand Down Expand Up @@ -83,8 +87,6 @@ main {
/*! Extensions from @primer/css/alerts/flash.scss */
--color-social-reaction-bg-hover: var(--color-scale-gray-7);
--color-social-reaction-bg-reacted-hover: var(--color-scale-blue-8);

color-scheme: dark;
}

main .pagination-loader-container {
Expand Down
6 changes: 4 additions & 2 deletions styles/themes/dark_high_contrast.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
* https://github.com/primer/primitives/blob/main/LICENSE
*/

html {
color-scheme: dark;
}

main {
--color-prettylights-syntax-comment: #bdc4cc;
--color-prettylights-syntax-constant: #91cbff;
Expand Down Expand Up @@ -83,8 +87,6 @@ main {
/*! Extensions from @primer/css/alerts/flash.scss */
--color-social-reaction-bg-hover: var(--color-scale-gray-7);
--color-social-reaction-bg-reacted-hover: var(--color-scale-blue-8);

color-scheme: dark;
}

main .pagination-loader-container {
Expand Down
6 changes: 4 additions & 2 deletions styles/themes/dark_protanopia.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
* https://github.com/primer/primitives/blob/main/LICENSE
*/

html {
color-scheme: dark;
}

main {
--color-prettylights-syntax-comment: #8b949e;
--color-prettylights-syntax-constant: #79c0ff;
Expand Down Expand Up @@ -83,8 +87,6 @@ main {
/*! Extensions from @primer/css/alerts/flash.scss */
--color-social-reaction-bg-hover: var(--color-scale-gray-7);
--color-social-reaction-bg-reacted-hover: var(--color-scale-blue-8);

color-scheme: dark;
}

main .pagination-loader-container {
Expand Down
6 changes: 4 additions & 2 deletions styles/themes/dark_tritanopia.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
* https://github.com/primer/primitives/blob/main/LICENSE
*/

html {
color-scheme: dark;
}

main {
--color-prettylights-syntax-comment: #8b949e;
--color-prettylights-syntax-constant: #79c0ff;
Expand Down Expand Up @@ -83,8 +87,6 @@ main {
/*! Extensions from @primer/css/alerts/flash.scss */
--color-social-reaction-bg-hover: var(--color-scale-gray-7);
--color-social-reaction-bg-reacted-hover: var(--color-scale-blue-8);

color-scheme: dark;
}

main .pagination-loader-container {
Expand Down
6 changes: 4 additions & 2 deletions styles/themes/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
* https://github.com/primer/primitives/blob/main/LICENSE
*/

html {
color-scheme: light;
}

main {
--color-prettylights-syntax-comment: #6e7781;
--color-prettylights-syntax-constant: #0550ae;
Expand Down Expand Up @@ -83,8 +87,6 @@ main {
/*! Extensions from @primer/css/alerts/flash.scss */
--color-social-reaction-bg-hover: var(--color-scale-gray-1);
--color-social-reaction-bg-reacted-hover: var(--color-scale-blue-1);

color-scheme: light;
}

main .pagination-loader-container {
Expand Down
6 changes: 4 additions & 2 deletions styles/themes/light_high_contrast.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
* https://github.com/primer/primitives/blob/main/LICENSE
*/

html {
color-scheme: light;
}

main {
--color-prettylights-syntax-comment: #66707b;
--color-prettylights-syntax-constant: #023b95;
Expand Down Expand Up @@ -83,8 +87,6 @@ main {
/*! Extensions from @primer/css/alerts/flash.scss */
--color-social-reaction-bg-hover: var(--color-scale-gray-1);
--color-social-reaction-bg-reacted-hover: var(--color-scale-blue-1);

color-scheme: light;
}

main .pagination-loader-container {
Expand Down
6 changes: 4 additions & 2 deletions styles/themes/light_protanopia.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
* https://github.com/primer/primitives/blob/main/LICENSE
*/

html {
color-scheme: light;
}

main {
--color-prettylights-syntax-comment: #6e7781;
--color-prettylights-syntax-constant: #0550ae;
Expand Down Expand Up @@ -83,8 +87,6 @@ main {
/*! Extensions from @primer/css/alerts/flash.scss */
--color-social-reaction-bg-hover: var(--color-scale-gray-1);
--color-social-reaction-bg-reacted-hover: var(--color-scale-blue-1);

color-scheme: light;
}

main .pagination-loader-container {
Expand Down
6 changes: 4 additions & 2 deletions styles/themes/light_tritanopia.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
* https://github.com/primer/primitives/blob/main/LICENSE
*/

html {
color-scheme: light;
}

main {
--color-prettylights-syntax-comment: #6e7781;
--color-prettylights-syntax-constant: #0550ae;
Expand Down Expand Up @@ -83,8 +87,6 @@ main {
/*! Extensions from @primer/css/alerts/flash.scss */
--color-social-reaction-bg-hover: var(--color-scale-gray-1);
--color-social-reaction-bg-reacted-hover: var(--color-scale-blue-1);

color-scheme: light;
}

main .pagination-loader-container {
Expand Down
12 changes: 8 additions & 4 deletions styles/themes/preferred_color_scheme.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
* https://github.com/primer/primitives/blob/main/LICENSE
*/

html {
color-scheme: light;
}

main {
--color-prettylights-syntax-comment: #6e7781;
--color-prettylights-syntax-constant: #0550ae;
Expand Down Expand Up @@ -84,8 +88,6 @@ main {
/*! Extensions from @primer/css/alerts/flash.scss */
--color-social-reaction-bg-hover: var(--color-scale-gray-1);
--color-social-reaction-bg-reacted-hover: var(--color-scale-blue-1);

color-scheme: light;
}

main .pagination-loader-container {
Expand All @@ -103,6 +105,10 @@ main .gsc-loading-image {
* https://github.com/primer/primitives/blob/main/LICENSE
*/

html {
color-scheme: dark;
}

main {
--color-prettylights-syntax-comment: #8b949e;
--color-prettylights-syntax-constant: #79c0ff;
Expand Down Expand Up @@ -184,8 +190,6 @@ main .gsc-loading-image {
/*! Extensions from @primer/css/alerts/flash.scss */
--color-social-reaction-bg-hover: var(--color-scale-gray-7);
--color-social-reaction-bg-reacted-hover: var(--color-scale-blue-8);

color-scheme: dark;
}

main .pagination-loader-container {
Expand Down
6 changes: 4 additions & 2 deletions styles/themes/transparent_dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
* https://github.com/primer/primitives/blob/main/LICENSE
*/

html {
color-scheme: dark;
}

main {
--color-prettylights-syntax-comment: #8b949e;
--color-prettylights-syntax-constant: #79c0ff;
Expand Down Expand Up @@ -85,8 +89,6 @@ main {
/*! Extensions from @primer/css/alerts/flash.scss */
--color-social-reaction-bg-hover: var(--color-scale-gray-7);
--color-social-reaction-bg-reacted-hover: var(--color-scale-blue-8);

color-scheme: dark;
}

main .pagination-loader-container {
Expand Down

0 comments on commit 0a315b0

Please sign in to comment.