Skip to content

Add templates theming to docs.rs #1116

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

Merged
merged 5 commits into from
Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Improve input rendering
  • Loading branch information
GuillaumeGomez committed Oct 23, 2020
commit 9196477ca01e60cbaed561722f7a617650baf4c7
15 changes: 15 additions & 0 deletions templates/style/_themes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
html {
--color-background-code: #f5f5f5;
--color-background: #fff;
--input-color: #000;
--input-box-shadow-focus: 0 0 8px #078dd8;
--color-border-light: #eaeaea;
--color-border: #ddd;
--color-doc-link-background: #333;
Expand All @@ -23,6 +25,9 @@ html {
--color-background-input: #fff;
--color-table-header-background: #e0e0e0;
--color-table-header: #000;
--color-search-focus: #078dd8;
--chart-title-color: #000;
--chart-grid: #ddd;
}

// To add a new theme, copy the above theme into a new `html[data-theme="name"]`
Expand All @@ -31,6 +36,8 @@ html {
html[data-theme="dark"] {
--color-background-code: #2a2a2a;
--color-background: #353535;
--input-color: #111;
--input-box-shadow-focus: 0 0 8px 4px #078dd8;
--color-border-light: #eaeaea;
--color-border: #4e4e4e;
--color-doc-link-background: #c0c0c0;
Expand All @@ -52,11 +59,16 @@ html[data-theme="dark"] {
--color-background-input: #f0f0f0;
--color-table-header-background: #e0e0e0;
--color-table-header: #000;
--color-search-focus: #078dd8;
--chart-title-color: #c0c0c0;
--chart-grid: #4e4e4e;
}

html[data-theme="ayu"] {
--color-background-code: #191f26;
--color-background: #0f1419;
--input-color: #c5c5c5;
--input-box-shadow-focus: 0 0 0 1px #148099,0 0 0 2px transparent;
--color-border-light: #eaeaea;
--color-border: #424c57;
--color-doc-link-background: #d5d5d5;
Expand All @@ -78,4 +90,7 @@ html[data-theme="ayu"] {
--color-background-input: #141920;
--color-table-header-background: #364759;
--color-table-header: #eee;
--color-search-focus: #148099;
--chart-title-color: #e6e6e6;
--chart-grid: #5c6773;
}
21 changes: 19 additions & 2 deletions templates/style/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ body {

input, #search {
background-color: var(--color-background-input);
color: var(--color-standard);
color: var(--input-color);
}

#search {
Expand All @@ -36,7 +36,7 @@ body {
}

#search:focus {
box-shadow: 0 0 0 1px #148099, 0 0 0 1px #148099;
box-shadow: var(--input-box-shadow-focus);
}

// rustdocs have 200px sidebar and
Expand Down Expand Up @@ -76,6 +76,23 @@ body {
> h1 {
color: var(--color-standard);
}

// This is used to improve charts rendering on all themes.
rect.highcharts-background {
fill: var(--color-background);
}

text.highcharts-title, g.highcharts-axis-labels > text {
fill: var(--chart-title-color) !important;
}

g.highcharts-legend-item > text {
fill: var(--chart-grid) !important;
}

g.highcharts-grid > path {
stroke: var(--chart-grid) !important;
}
}

html {
Expand Down