Dark mode (#66)
This commit is contained in:
parent
5eff47c68b
commit
59be9a504f
50 changed files with 1527 additions and 1154 deletions
|
@ -34,3 +34,4 @@ params:
|
|||
geekdocPrivacyPolicy: https://thegeeklab.de/legal-notice/#privacy-policy
|
||||
|
||||
geekdocImageLazyLoading: true
|
||||
geekdocDarkModeDim: true
|
||||
|
|
4
exampleSite/content/features/_index.html
Normal file
4
exampleSite/content/features/_index.html
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Features
|
||||
weight: -15
|
||||
---
|
13
exampleSite/content/features/dark-mode/_index.md
Normal file
13
exampleSite/content/features/dark-mode/_index.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
title: Dark Mode
|
||||
---
|
||||
|
||||
Say hello to the dark mode of the Geekdoc theme!
|
||||
|
||||
[](images/geekdoc-dark.png)
|
||||
|
||||
The dark mode can be used in two different ways. If you have JavaScript disabled in your browser, the dark mode automatically detects the preferred system settings via the `prefers-color-scheme` parameter. Depending on the value, the theme will automatically switch between dark and light mode if this feature is supported by your operating system and browser.
|
||||
|
||||
The second mode requires JavaScript and is controlled by a dark mode switch in the upper right corner. You can switch between three modes: Auto, Dark and Light. Auto mode works the same as the first method mentioned above and automatically detects the system setting. Dark and Light modes allow you to force one of them for your Geekdoc page only, regardless of the system setting. This works even if your browser or operating system does not support the system setting. The current selection is stored locally via the Web Storage API.
|
||||
|
||||
To avoid very bright spots often caused by images while using the dark mode we have added an optional auto-dim feature that can be enabled with the side parameter `geekdocDarkModeDim` (see [Configuration](/usage/configuration/)). As this may have an impact on the quality of the images it is disabled by default.
|
BIN
exampleSite/content/features/dark-mode/images/geekdoc-dark.png
Normal file
BIN
exampleSite/content/features/dark-mode/images/geekdoc-dark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 462 KiB |
|
@ -1,10 +1,10 @@
|
|||
---
|
||||
title: Icons
|
||||
title: Icon Sets
|
||||
---
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
## Custom icons
|
||||
## Custom icon sets
|
||||
|
||||
The only supported source for custom icons are SVG sprites. Some icon frameworks provides ready to use sprites e.g. FontAwesome. If the framework don't provide sprites, you can create your own from raw SVG icons. There are a lot of tools available to create sprites, please choose one that fits your need. One solution could be [svgsprit.es](https://svgsprit.es/).
|
||||
|
||||
|
@ -26,7 +26,7 @@ The result of a valid minimal SVG sprite file could look like this:
|
|||
|
||||
**Example:**
|
||||
|
||||
FontAwesome provides three pre-build sprites included in the regular Web download pack, `sprites/brands.svg`, `sprites/regular.svg` and `sprites/solid.svg`. Choose your sprite to use and copy it to your projects root directory into `assets/sprites`, right beside your `content` folder. The result should look like this:
|
||||
FontAwesome provides three pre-build sprites included in the regular Web download pack, `sprites/brands.svg`, `sprites/regular.svg` and `sprites/solid.svg`. Choose your sprite to use and copy it to your projects root directory into `assets/sprites`, right beside your `content` folder:
|
||||
|
||||
```Bash
|
||||
my_projcet/
|
15
exampleSite/content/features/theming/_index.md
Normal file
15
exampleSite/content/features/theming/_index.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
If you want to customize the theme's color scheme to give it your individual touch, you are only a few lines of CSS away. Generally, you need to override the default settings. The easiest way to do this is to create a file named `static/custom.css` right at the root of your site.
|
||||
|
||||
All the necessary CSS customization properties are listed below. If you want to customize elements that don't use these properties, you can always look up the class name and override it directly. For inspiration, you can also take a look at [https://www.color-hex.com/color-palettes/](https://www.color-hex.com/). In this simple example, we'll use the [_Beach_](https://www.color-hex.com/color-palette/895) color palette.
|
||||
|
||||
[](images/theme-example.png)
|
||||
|
||||
**Custom CSS:**
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
<!-- spellchecker-disable -->
|
||||
{{< include file="/static/custom.css.example" language="CSS" options="linenos=table" >}}
|
||||
<!-- spellchecker-enable -->
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
Happy customizing!
|
BIN
exampleSite/content/features/theming/images/theme-example.png
Normal file
BIN
exampleSite/content/features/theming/images/theme-example.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 321 KiB |
|
@ -74,7 +74,7 @@ resources:
|
|||
|
||||
<!-- spellchecker-disable -->
|
||||
|
||||
{{< img name="forest-1" size="large" lazy=false >}}
|
||||
{{< img name="forest-1" lazy=false >}}
|
||||
|
||||
<!-- spellchecker-enable -->
|
||||
|
||||
|
@ -85,7 +85,7 @@ copious quo ad. Stet probates in duo.
|
|||
|
||||
<!-- spellchecker-disable -->
|
||||
|
||||
{{< img name="forest-2" size="large" lazy=true >}}
|
||||
{{< img name="forest-2" lazy=true >}}
|
||||
|
||||
<!-- spellchecker-enable -->
|
||||
|
||||
|
@ -96,7 +96,7 @@ copious quo ad. Stet probates in duo.
|
|||
|
||||
<!-- spellchecker-disable -->
|
||||
|
||||
{{< img name="forest-3" size="large" lazy=true >}}
|
||||
{{< img name="forest-3" lazy=true >}}
|
||||
|
||||
<!-- spellchecker-enable -->
|
||||
|
||||
|
@ -107,7 +107,7 @@ copious quo ad. Stet probates in duo.
|
|||
|
||||
<!-- spellchecker-disable -->
|
||||
|
||||
{{< img name="forest-4" size="large" lazy=true >}}
|
||||
{{< img name="forest-4" lazy=true >}}
|
||||
|
||||
<!-- spellchecker-enable -->
|
||||
|
||||
|
@ -118,7 +118,7 @@ copious quo ad. Stet probates in duo.
|
|||
|
||||
<!-- spellchecker-disable -->
|
||||
|
||||
{{< img name="forest-5" size="large" lazy=true >}}
|
||||
{{< img name="forest-5" lazy=true >}}
|
||||
|
||||
<!-- spellchecker-enable -->
|
||||
|
||||
|
@ -129,7 +129,7 @@ copious quo ad. Stet probates in duo.
|
|||
|
||||
<!-- spellchecker-disable -->
|
||||
|
||||
{{< img name="forest-6" size="large" lazy=true >}}
|
||||
{{< img name="forest-6" lazy=true >}}
|
||||
|
||||
<!-- spellchecker-enable -->
|
||||
|
||||
|
@ -140,6 +140,6 @@ copious quo ad. Stet probates in duo.
|
|||
|
||||
<!-- spellchecker-disable -->
|
||||
|
||||
{{< img name="forest-7" size="large" lazy=true >}}
|
||||
{{< img name="forest-7" lazy=true >}}
|
||||
|
||||
<!-- spellchecker-enable -->
|
||||
|
|
|
@ -30,7 +30,7 @@ fastidious copious quo ad. Stet probates in duo.
|
|||
This is tab **Linux** content.
|
||||
|
||||
Dolor sit, sumo unique argument um no. Gracie nominal id xiv. Romanesque acclimates
|
||||
investiture. **Ornateness** bland it ex enc, est yeti am bongo detract re. Pro ad
|
||||
investiture. Ornateness bland it ex enc, est yeti am bongo detract re. Pro ad
|
||||
prompts feud gait, quid exercise emeritus bis e. In pro quints consequent, denim
|
||||
fastidious copious quo ad. Stet probates in duo.
|
||||
{{< /tab >}}
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
If you want to customize the color scheme of the theme to give it your individual touch you are just a few lines CSS away. In general, you have to override the defaults, the easiest way to do so is to create a `static/custom.css` file right in your site root.
|
||||
|
||||
All necessary class names are listed below. If you miss some classes required for a color scheme you are very welcome to create an [Issue](https://github.com/thegeeklab/hugo-geekdoc/issues) or Pull Request. For some inspiration you can have a look at [https://www.color-hex.com/color-palettes/](https://www.color-hex.com/). The following listing use the _HC-primary_ color palette as an example:
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
<!-- markdownlint-disable -->
|
||||
<!-- spellchecker-disable -->
|
||||
{{< highlight CSS "linenos=table" >}}
|
||||
/* default link color */
|
||||
a { color: #1c388e; }
|
||||
a:visited { color: #73bfb8 }
|
||||
|
||||
/* site header */
|
||||
.gdoc-header { background: #e66a4e; border-color: #404040; }
|
||||
.gdoc-header__link, .gdoc-header__link:visited { color: #ffffff; }
|
||||
|
||||
/* page links */
|
||||
.gdoc-page__footer a, .gdoc-page__footer a:visited { color: #1c388e; }
|
||||
.gdoc-page__header a, .gdoc-page__header a:visited { color: #1c388e; }
|
||||
|
||||
/* site footer */
|
||||
.gdoc-footer { background: #404040; color: #ffffff; }
|
||||
.gdoc-footer__link{ color: #fecf50; }
|
||||
.gdoc-footer__link:visited, .gdoc-footer__link:hover { color: #fecf50; }
|
||||
|
||||
/* custom shortcodes */
|
||||
/* button */
|
||||
.gdoc-button { color: #495057; }
|
||||
.gdoc-button:hover { background-color: #eb8771; border-color: #e66a4e; color: #ffffff; }
|
||||
|
||||
/* hint */
|
||||
.gdoc-hint.info { background: #d1d7e8; border-color: #324b99; color: black; }
|
||||
.gdoc-hint.warning { background: #fef5dc; border-color: #e4ba48; color: black; }
|
||||
.gdoc-hint.danger { background: #fae1db; border-color: #cf5f46; color: black; }
|
||||
{{< /highlight >}}
|
||||
<!-- spellchecker-enable -->
|
||||
<!-- markdownlint-enable -->
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
And that is how the result will looks like. Happy customizing!
|
||||
|
||||
[](images/colorscheme-example.png)
|
Binary file not shown.
Before Width: | Height: | Size: 159 KiB |
|
@ -90,6 +90,10 @@ enableGitInfo = true
|
|||
# a subdirectory is used within Hugo's BaseURL.
|
||||
# See https://developer.mozilla.org/de/docs/Web/HTML/Element/base.
|
||||
geekdocOverwriteHTMLBase = false
|
||||
|
||||
# (Optional, default false) Auto-decrease brightness of images and add a slightly grayscale to avoid
|
||||
# bright spots while using the dark mode.
|
||||
geekdocDarkModeDim = false
|
||||
```
|
||||
|
||||
{{< /tab >}}
|
||||
|
@ -178,6 +182,10 @@ params:
|
|||
# a subdirectory is used within Hugo's BaseURL.
|
||||
# See https://developer.mozilla.org/de/docs/Web/HTML/Element/base.
|
||||
geekdocOverwriteHTMLBase: false
|
||||
|
||||
# (Optional, default false) Auto-decrease brightness of images and add a slightly grayscale to avoid
|
||||
# bright spots while using the dark mode.
|
||||
geekdocDarkModeDim: false
|
||||
```
|
||||
|
||||
{{< /tab >}}
|
||||
|
|
|
@ -58,7 +58,7 @@ main:
|
|||
ref: "/level-2/level-2-2"
|
||||
```
|
||||
|
||||
As an advantage you can add [icons](/usage/icons/) to your menu entries e.g. `icon: "notification"`.
|
||||
As an advantage you can add [icons](/features/icon-sets/) to your menu entries e.g. `icon: "notification"`.
|
||||
|
||||
[](/media/bundle-menu.png)
|
||||
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
"arrow_right_alt",
|
||||
"bitbucket",
|
||||
"bookmark",
|
||||
"brightness_auto",
|
||||
"brightness_dark",
|
||||
"brightness_light",
|
||||
"cloud_off",
|
||||
"code",
|
||||
"date",
|
||||
|
|
|
@ -1,25 +1,116 @@
|
|||
/* defaut link color */
|
||||
a { color: #1c388e; }
|
||||
a:visited { color: #73bfb8 }
|
||||
/* Light mode theming */
|
||||
:root,
|
||||
:root[color-mode="light"] {
|
||||
--header-background: #4ec58a;
|
||||
--header-font-color: #ffffff;
|
||||
|
||||
/* site header */
|
||||
.gdoc-header { background: #e66a4e; border-color: #404040; }
|
||||
.gdoc-header__link, .gdoc-header__link:visited { color: #ffffff; }
|
||||
--body-background: #ffffff;
|
||||
--body-font-color: #343a40;
|
||||
|
||||
/* page links */
|
||||
.gdoc-page__footer a, .gdoc-page__footer a:visited, .gdoc-page__header a, .gdoc-page__header a:visited { color: #1c388e; }
|
||||
--button-background: #62cb97;
|
||||
--button-border-color: #4ec58a;
|
||||
|
||||
/* site footer */
|
||||
.gdoc-footer { background: #404040; color: #ffffff; }
|
||||
.gdoc-footer__link{ color: #fecf50; }
|
||||
.gdoc-footer__link:visited, .gdoc-footer__link:hover { color: #fecf50; }
|
||||
--link-color: #518169;
|
||||
--link-color-visited: #c54e8a;
|
||||
|
||||
--code-background: #f5f6f8;
|
||||
--code-accent-color: #e3e7eb;
|
||||
--code-accent-color-lite: #eff1f3;
|
||||
|
||||
/* button shortcode */
|
||||
.gdoc-button { color: #495057; }
|
||||
.gdoc-button:hover { background-color: #eb8771; border-color: #e66a4e; color: #ffffff; }
|
||||
--accent-color: #e9ecef;
|
||||
--accent-color-lite: #f8f9fa;
|
||||
|
||||
/* hint shortcode */
|
||||
.gdoc-hint.info { background: #d1d7e8; border-color: #324b99; color: black; }
|
||||
.gdoc-hint.warning { background: #fef5dc; border-color: #e4ba48; color: black; }
|
||||
.gdoc-hint.danger { background: #fae1db; border-color: #cf5f46; color: black; }
|
||||
--control-icons: #b2bac1;
|
||||
|
||||
--footer-background: #2f333e;
|
||||
--footer-font-color: #ffffff;
|
||||
--footer-link-color: #ffcc5c;
|
||||
--footer-link-color-visited: #ffcc5c;
|
||||
}
|
||||
@media (prefers-color-scheme: light) {
|
||||
:root {
|
||||
--header-background: #4ec58a;
|
||||
--header-font-color: #ffffff;
|
||||
|
||||
--body-background: #ffffff;
|
||||
--body-font-color: #343a40;
|
||||
|
||||
--button-background: #62cb97;
|
||||
--button-border-color: #4ec58a;
|
||||
|
||||
--link-color: #518169;
|
||||
--link-color-visited: #c54e8a;
|
||||
|
||||
--code-background: #f5f6f8;
|
||||
--code-accent-color: #e3e7eb;
|
||||
--code-accent-color-lite: #eff1f3;
|
||||
|
||||
--accent-color: #e9ecef;
|
||||
--accent-color-lite: #f8f9fa;
|
||||
|
||||
--control-icons: #b2bac1;
|
||||
|
||||
--footer-background: #2f333e;
|
||||
--footer-font-color: #ffffff;
|
||||
--footer-link-color: #ffcc5c;
|
||||
--footer-link-color-visited: #ffcc5c;
|
||||
}
|
||||
}
|
||||
|
||||
/* Dark mode theming */
|
||||
:root[color-mode="dark"] {
|
||||
--header-background: #4ec58a;
|
||||
--header-font-color: #ffffff;
|
||||
|
||||
--body-background: #343a40;
|
||||
--body-font-color: #ced3d8;
|
||||
|
||||
--button-background: #62cb97;
|
||||
--button-border-color: #4ec58a;
|
||||
|
||||
--link-color: #7ac29e;
|
||||
--link-color-visited: #c27a9e;
|
||||
|
||||
--code-background: #2f353a;
|
||||
--code-accent-color: #262b2f;
|
||||
--code-accent-color-lite: #2b3035;
|
||||
|
||||
--accent-color: #2b3035;
|
||||
--accent-color-lite: #2f353a;
|
||||
|
||||
--control-icons: #b2bac1;
|
||||
|
||||
--footer-background: #2f333e;
|
||||
--footer-font-color: #ffffff;
|
||||
--footer-link-color: #ffcc5c;
|
||||
--footer-link-color-visited: #ffcc5c;
|
||||
}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--header-background: #4ec58a;
|
||||
--header-font-color: #ffffff;
|
||||
|
||||
--body-background: #343a40;
|
||||
--body-font-color: #ced3d8;
|
||||
|
||||
--button-background: #62cb97;
|
||||
--button-border-color: #4ec58a;
|
||||
|
||||
--link-color: #7ac29e;
|
||||
--link-color-visited: #c27a9e;
|
||||
|
||||
--code-background: #2f353a;
|
||||
--code-accent-color: #262b2f;
|
||||
--code-accent-color-lite: #2b3035;
|
||||
|
||||
--accent-color: #2b3035;
|
||||
--accent-color-lite: #2f353a;
|
||||
|
||||
--control-icons: #b2bac1;
|
||||
|
||||
--footer-background: #2f333e;
|
||||
--footer-font-color: #ffffff;
|
||||
--footer-link-color: #ffcc5c;
|
||||
--footer-link-color-visited: #ffcc5c;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue