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

Support for changing theme in config.yaml #1

Merged
merged 25 commits into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Additionally, you may choose to set the following optional variables:
```yml
show_downloads: ["true" or "false" (unquoted) to indicate whether to provide a download URL]
google_analytics: [Your Google Analytics tracking ID]
color-scheme: ["dark", "light", "auto" or "auto-deafualt-dark" auto is deafault setting and changes theme based on device theme, auto-deafualt-dark is the same except if you device does not support changing theme based on device theme it will deafault to dark and the others are fairly explanetory.]
```

### Stylesheet
Expand Down
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ description: Minimal is a theme for GitHub Pages.
show_downloads: true
google_analytics:
theme: jekyll-theme-minimal
#color-scheme: auto-deafualt-dark
11 changes: 10 additions & 1 deletion _layouts/default.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
{% case site.color-scheme %}
{% when "", nil, false, 0, empty %}
{% assign ColorScheme = "auto" %}
{% else %}
{% assign ColorScheme = site.color-scheme %}
{% endcase %}


<!DOCTYPE html>
<html lang="{{ site.lang | default: "en-US" }}">
<head>
Expand All @@ -6,7 +14,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1">

{% seo %}
<link rel="stylesheet" href="{{ "/assets/css/style.css?v=" | append: site.github.build_revision | relative_url }}">
<link rel="stylesheet" href="{{ "/assets/css/colors-ColorScheme.css?v=" | append: site.github.build_revision | relative_url | replace: "ColorScheme", {{ColorScheme}} }}">
<link rel="stylesheet" href="{{ "/assets/css/style.css?v=" | append: site.github.build_revision | relative_url }}">
<!--[if lt IE 9]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<![endif]-->
Expand Down
13 changes: 1 addition & 12 deletions _sass/colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ hvr -> hover

@mixin colors {
// buttons
--L-a-text-hover-change: 0.8;//the number that --L-a-text gets changed by when it is hovered eg a button has 30% luminosity when left it luminosity is then timesed by 0.8 when the button is hovered
--clr-a-text: hsl(200, 100%, var(--L-a-text));
--clr-a-text-hvr: hsl(200, 100%, calc(var(--L-a-text) * var(--L-a-text-hover-change)));
--clr-buttons-main-bg: hsl(0, 0%, var(--L-buttons-main-bg));//the buttons in the main section at the top titled "download zip" "download tarbell" "veiw on github"
Expand Down Expand Up @@ -121,15 +122,3 @@ hvr -> hover
--L-small-in-a: 60%;
--L-table-header-and-dt: 90%; //more on dt's https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_dd_test
}

:root {
--L-a-text-hover-change: 0.8;//the number that --L-a-text gets changed by when it is hovered eg a button has 30% luminosity when left it luminosity is then timesed by 0.8 when the button is hovered
@include colors;
@include light-colors;
}

@media screen and (prefers-color-scheme: dark) {//we would not like to apply dark mode if content is on printer as that would use a lot of ink
:root{
@include dark-colors;
}
}
1 change: 0 additions & 1 deletion _sass/jekyll-theme-minimal.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@import "fonts";
@import "rouge-github";
@import "colors";

body {
background-color: var(--clr-bg);
Expand Down
17 changes: 17 additions & 0 deletions assets/css/colors-auto-deafualt-dark.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
---

//this mode is like colors-auto but if the device does not support @media prefers-color-scheme it will deafault to dark mode

@import "colors";

:root {
@include colors;
@include dark-colors;
}

@media print, (prefers-color-scheme: light) {//we would not like to apply dark mode if content is on printer as that would use a lot of ink
:root {
@include light-colors;
}
}
15 changes: 15 additions & 0 deletions assets/css/colors-auto.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
---

@import "colors";

:root {
@include colors;
@include light-colors;
}

@media screen and (prefers-color-scheme: dark) {//we would not like to apply dark mode if content is on printer as that would use a lot of ink
:root{
@include dark-colors;
}
}
15 changes: 15 additions & 0 deletions assets/css/colors-dark.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
---

@import "colors";

:root {
@include colors;
@include dark-colors;
}

@media print {
:root {
@include light-colors;
}
}
9 changes: 9 additions & 0 deletions assets/css/colors-light.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
---

@import "colors";

:root {
@include colors;
@include light-colors;
}