Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial dark mode support #268

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 34 additions & 11 deletions lib/rdoc/generator/template/rails/resources/css/main.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
:root {
--text-color: #3B3B3B;
--background-color: #fff;
--border-color: #ccc;
--code-background-color: #eee;
--source-background-color: #fffde8;
--method-heading-color: #555;
}

html {
height: 100%;
}

body {
font-family: "Helvetica Neue", Arial, sans-serif;
background: #FFF;
color: #3B3B3B;
background: var(--background-color);
color: var(--text-color);
margin: 0px;
font-size: 15px;
line-height: 1.25em;
Expand Down Expand Up @@ -95,7 +105,7 @@ h2 {

h3 {
font-size: 1.4em;
color:#555;
color: var(--method-heading-color);
margin: 1.4em 0 0.7em 0;
font-weight: normal;
}
Expand Down Expand Up @@ -238,7 +248,7 @@ pre
font-size: 1.2em;
padding: 0 0 0.25em 0;
font-weight: bold;
border-bottom: 1px solid #000;
border-bottom: 1px solid var(--border-color);
}

.contenttitle {
Expand Down Expand Up @@ -275,7 +285,7 @@ tt {
}

.dyn-source {
background: #fffde8;
background: var(--source-background-color);
color: #000;
border: #ffe0bb dotted 1px;
margin: 0.5em 2em 0.5em 0;
Expand All @@ -284,7 +294,7 @@ tt {

.description pre {
padding: 1em 1.2em;
background: #EEEEEE;
background: var(--code-background-color);
border-radius: 10px;
font-size: 15px;
}
Expand All @@ -309,7 +319,7 @@ tt {
padding: 0 0 0.2em 0;
margin-bottom: 0.8em;
font-size: 1.1em;
color:#333;
color: var(--heading-color);
}
.method .method-title {
border-bottom: 1px dotted #666;
Expand Down Expand Up @@ -374,9 +384,8 @@ tt {
}

p code {
background: #eeeeee;
border-radius: 2px;
border: 1px solid #dddddd;
background: var(--code-background-color);
border-radius: 5px;
font-family: Consolas, Menlo, Courier, monospace;
font-size: 14px;
margin-bottom: 1px;
Expand Down Expand Up @@ -447,7 +456,6 @@ a.back-to-top.show {
visibility: visible;
}


/*
* More-Less widget
*/
Expand Down Expand Up @@ -485,3 +493,18 @@ details.more-less:not([open]) .more-less__less,
details.more-less[open] .more-less__more {
display: none;
}

@media (prefers-color-scheme: dark) {
:root {
--text-color: #ddd;
--background-color: #222222;
--border-color: #444;
--code-background-color: #000000;
--source-background-color: #000000;
--method-heading-color: #ccc;
}

body {
--link-color: #ee3f3f;
}
}
52 changes: 37 additions & 15 deletions lib/rdoc/generator/template/rails/resources/css/panel.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
/* Panel (begin) */
:root {
--panel-hover-background-color: #d0d0d0;
--panel-alternate-background-color: #F0EFEF;
--panel-current-background-color: #B61D1D;
--panel-highlight-color: #000;
}
.panel_checkbox, .panel_mobile_button, .panel_mobile_button_close
{
display: none;
Expand Down Expand Up @@ -82,11 +88,11 @@
top: 0;
width: 300px;
height: 100%;
background: #FFF;
background: var(--background-color);
z-index: 200;
font-family: "Helvetica Neue", "Arial", sans-serif;
overflow-x: hidden;
border-right: 1px #ccc solid;
border-right: 1px solid var(--border-color);
line-height: 1;
}

Expand Down Expand Up @@ -131,7 +137,7 @@
/* Header with search box (begin) */
.panel .header
{
background: white url(../i/search.svg) no-repeat;
background: var(--background-color) url(../i/search.svg) no-repeat;
background-position: 5px;
box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
height: 40px;
Expand Down Expand Up @@ -162,6 +168,8 @@
margin: 0;
margin-left: 25px;
outline: none;
background: var(--background-color);
color: var(--text-color);
}

@media (max-width: 599px) {
Expand Down Expand Up @@ -205,14 +213,14 @@
}

.panel .result ul li:nth-child(2n) {
background: #F0EFEF;
background: var(--panel-alternate-background-color);
}

.panel .result ul li h1
{
font-size: 13px;
font-weight: normal;
color: #333;
color: var(--text-color);
margin-top: 0;
margin-bottom: 2px;
white-space: nowrap;
Expand All @@ -221,7 +229,7 @@
.panel .result ul li p
{
font-size: 11px;
color: #333;
color: var(--text-color);
margin-bottom: 2px;
white-space: nowrap;
}
Expand All @@ -234,12 +242,12 @@

.panel .result ul li b
{
color: #000;
color: var(--panel-highlight-color);
}

.panel .result ul li.current
{
background: #B61D1D;
background: var(--panel-current-background-color);
}

.panel .result ul li.current h1,
Expand All @@ -263,12 +271,12 @@
.panel .result ul li:hover,
.panel .result ul li.selected
{
background: #d0d0d0;
background: var(--panel-hover-background-color);
}

.panel .result ul li.current:hover
{
background: #B61D1D;
background: var(--panel-current-background-color);
}

.panel .result ul li .badge
Expand Down Expand Up @@ -345,7 +353,7 @@
/* Tree (begin) */ /**/
.panel .tree
{
background: white;
background: var(--background-color);
position: relative;
bottom: 0;
left: 0;
Expand Down Expand Up @@ -402,7 +410,7 @@
{
font-size: 13px;
font-weight: normal;
color: #000;
color: var(--text-color);
margin-top: 0;
margin-bottom: 2px;
white-space: nowrap;
Expand Down Expand Up @@ -441,7 +449,7 @@

.panel .tree ul li.current
{
background: #B61D1D;
background: var(--panel-current-background-color);
}

.panel .tree ul li.current .icon
Expand Down Expand Up @@ -474,18 +482,32 @@

.panel .tree ul li:hover
{
background: #d0d0d0;
background: var(--panel-hover-background-color);
}

.panel .tree ul li.current:hover
{
background: #B61D1D;
background: var(--panel-current-background-color);
}

.panel .tree .stopper
{
display: none;
}

@media (prefers-color-scheme: dark) {
:root {
--panel-hover-background-color: #3b3b3b;
--panel-alternate-background-color: #000000;
--panel-highlight-color: #fff;
}

.panel .tree ul:first-child {
background: url(../i/dark/tree_bg.svg);
background-size: 1px 60px;
}
}

/* Tree (end) */ /**/

/* Panel (end) */
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.