Skip to content

Commit

Permalink
Merge pull request #106 from ENCCS/selection-bg-color
Browse files Browse the repository at this point in the history
Use a custom selection background and foreground color
  • Loading branch information
rkdarst authored Oct 13, 2024
2 parents d640423 + 8ecedb9 commit fbdf2a3
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion sphinx_lesson/_static/sphinx_lesson.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
/* sphinx_lesson.css */
/* sphinx_lesson.css
* https://webaim.org/resources/contrastchecker/?fcolor=00000&bcolor=FCE762
* */
:root {
--sphinx-lesson-selection-bg-color: #fce762;
--sphinx-lesson-selection-fg-color: #000000;
}

/* https://webaim.org/resources/contrastchecker/?fcolor=FFFFFF&bcolor=745315
* when dark theme is selected the some themes use this attirbute
*/
html[data-theme='dark'], body[data-theme='dark'] {
--sphinx-lesson-selection-bg-color: #745315;
--sphinx-lesson-selection-fg-color: #ffffff;
}

/* when browser/system theme is dark and no theme is selected */
@media (prefers-color-scheme: dark) {
html[data-theme='auto'], body[data-theme='auto'] {
--sphinx-lesson-selection-bg-color: #745315;
--sphinx-lesson-selection-fg-color: #ffffff;
}
}

body.wy-body-for-nav img.with-border {
border: 2px solid;
Expand Down Expand Up @@ -49,3 +71,33 @@ body.wy-body-for-nav img.with-border {
.rst-content .admonition.toggle-hidden {
padding-bottom: 0px;
}

/* selection / highlight colour uses a yellow background and a black text */
/*** Works on common browsers ***/
::selection {
background-color: var(--sphinx-lesson-selection-bg-color);
color: var(--sphinx-lesson-selection-fg-color);
}

/*** Mozilla based browsers ***/
::-moz-selection {
background-color: var(--sphinx-lesson-selection-bg-color);
color: var(--sphinx-lesson-selection-fg-color);
}

/***For Other Browsers ***/
::-o-selection {
background-color: var(--sphinx-lesson-selection-bg-color);
color: var(--sphinx-lesson-selection-fg-color);
}

::-ms-selection {
background-color: var(--sphinx-lesson-selection-bg-color);
color: var(--sphinx-lesson-selection-fg-color);
}

/*** For Webkit ***/
::-webkit-selection {
background-color: var(--sphinx-lesson-selection-bg-color);
color: var(--sphinx-lesson-selection-fg-color);
}

0 comments on commit fbdf2a3

Please sign in to comment.