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

use css vars and @media queries to change colours depending on device theme #135

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d4f0dbb
use css vars and add @media quiru to change colours
godalming123 Aug 18, 2021
b31159f
fix mistype
godalming123 Aug 18, 2021
b6ac7ef
use my variables instead of the sass ones
godalming123 Aug 18, 2021
f1aa60b
fix error
godalming123 Aug 19, 2021
5db6b9b
Set theme jekyll-theme-cayman
godalming123 Aug 19, 2021
6228184
fix error
godalming123 Aug 20, 2021
1f1c59f
add roundedness + fix bugs
godalming123 Aug 20, 2021
5cf0d58
fix skip to content
godalming123 Aug 20, 2021
1f17fa9
fix content
godalming123 Aug 20, 2021
9dd65fe
fix
godalming123 Aug 20, 2021
874d57a
update colors
godalming123 Aug 20, 2021
15e22fd
improve bg color
godalming123 Aug 20, 2021
c343245
fix code blocks
godalming123 Aug 20, 2021
74ce417
improve blockquote color
godalming123 Aug 20, 2021
eebb224
bolder headers
godalming123 Aug 20, 2021
119d019
use mixins and add more colours for code
godalming123 Aug 20, 2021
e117645
use colours for code
godalming123 Aug 20, 2021
c7c89fa
addmore colours for code
godalming123 Aug 20, 2021
25fcb4b
fix table borders not showin in dark mode
godalming123 Aug 20, 2021
c58e1d5
init branch
godalming123 Aug 24, 2021
f7dd423
fix dark mode coloring for dark and auto-deafualt-dark color schemes
godalming123 Aug 24, 2021
030f34f
make it clear you can customize the color scheme in config.yaml
godalming123 Aug 24, 2021
cccbafc
make color-scheme deafualt to auto if it is undefined
Aug 26, 2021
464a0ad
Merge pull request #1 from godalming123/support-for-changing-theme-wi…
Aug 26, 2021
c84f73d
add experminetal theme with black code blocks
Aug 26, 2021
810a624
fix spelling of default
Oct 26, 2021
15c356a
Improve the style choices
godalming123 Oct 11, 2023
37395cc
fix
godalming123 Oct 11, 2023
50942db
fix 2
godalming123 Oct 11, 2023
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.]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: “default” is the correct spelling, multiple places

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I've fixed all the occurrences in my commit below. Sorry I'm not the best at spelling and the maintainers arent really keeping track of pull request so I have stopped checking this pull.

Copy link

@DaveSkender DaveSkender Oct 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think defaulting to "auto" here when the original is "light" might also be an unexpected change for anyone using "latest" versions / not using a specific version of this template. Defaulting to "light" might be less risk of surprises for users.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I'm aware the only way that new users can come across this is if they find this PR, in which case they will only use it if they want their site to have a dark theme. Sure, if the maintainers get back to me then new people could discover it without knowing about dark theme but I think for now better to save the confusion if it does not work for people who are trying to use this theme.

```

### Stylesheet
Expand Down
3 changes: 2 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ title: Cayman theme
description: Cayman is a clean, responsive theme for GitHub Pages.
show_downloads: true
google_analytics:
theme: jekyll-theme-cayman
theme: jekyll-theme-cayman
#color-scheme: auto-deafualt-dark
8 changes: 8 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{% 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 @@ -9,6 +16,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#157878">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="stylesheet" href="{{ "/assets/css/color-schemes/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 }}">
{% include head-custom.html %}
</head>
Expand Down
116 changes: 116 additions & 0 deletions _sass/colors.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
@mixin header-colors {
--header-heading-color: #fff;
--header-bg-color: #159957;
--header-bg-color-secondary: #155799;
}

@mixin light-colors {

// Text
--section-headings-color: #22cc77;
--body-text-color: #606c71;
--body-link-color: #1e6bb8;
--blockquote-text-color: #819198;

// Code
--code-bg-color: #f3f6fa;
--code-text-color: #567482;
//colors
--code-d14: #d14;
--code-red-dark: #aa0000;
--code-lightblue: #009999;
--code-009926: #009926;
--code-990073: #990073;
--code-008080: #008080;
--code-445588: #445588;
--code-grey-as: #aaaaaa;
--code-grey-9s: #999999;
--code-grey-8s: #888888;
--code-grey-5s: #555555;
--code-000080: #000080;
--code-990000: #990000;
--code-800080: #800080;
--code-3c5d5d: #3c5d5d;

// Borders
--border-color: #dce6f0;
--table-border-color: #e9ebec;
--hr-border-color: #eff0f1;

// Misilainius
--bg-color: white;
}

@mixin dark-colors {
// Text
--section-headings-color: #159957;
--body-text-color: #ffffff;
--body-link-color: #1e6bb8;
--blockquote-text-color: #b4b4b4;

// Code
--code-bg-color: #2e2e2e;
--code-text-color: #dbdbdb;
--code-bold-text-color: hsl(0, 0, 100%);
//colors
--code-d14: #d14;
--code-red-dark: #aa0000;
--code-lightblue: #009999;
--code-009926: #009926;
--code-990073: #990073;
--code-008080: #008080;
--code-445588: #445588;
--code-grey-as: #aaaaaa;
--code-grey-9s: #999999;
--code-grey-8s: #888888;
--code-grey-5s: #555555;
--code-000080: #000080;
--code-990000: #990000;
--code-800080: #800080;
--code-3c5d5d: #3c5d5d;

// Borders
--border-color: #606468;
--table-border-color: #3a3a3a;
--hr-border-color: #242424;

// Misilainius
--bg-color:hsl(0, 0%, 10%);
}

@mixin experimental-black-code-block-colors {
// Text
--section-headings-color: #159957;
--body-text-color: #ffffff;
--body-link-color: #1e6bb8;
--blockquote-text-color: #b4b4b4;

// Code
--code-bg-color: #080808;
--code-text-color: #dbdbdb;
--code-bold-text-color: hsl(0, 0, 100%);
//colors
--code-d14: #d14;
--code-red-dark: #aa0000;
--code-lightblue: #009999;
--code-009926: #009926;
--code-990073: #990073;
--code-008080: #008080;
--code-445588: #445588;
--code-grey-as: #aaaaaa;
--code-grey-9s: #999999;
--code-grey-8s: #888888;
--code-grey-5s: #555555;
--code-000080: #000080;
--code-990000: #990000;
--code-800080: #800080;
--code-3c5d5d: #3c5d5d;

// Borders
--border-color: #3c3c3c;
--table-border-color: #3a3a3a;
--hr-border-color: #242424;

// Misilainius
--bg-color:hsl(0, 0%, 10%);
}
42 changes: 22 additions & 20 deletions _sass/jekyll-theme-cayman.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@
}

body {
background-color: var(--bg-color);
padding: 0;
margin: 0;
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 16px;
line-height: 1.5;
color: $body-text-color;
color: var(--body-text-color);
}

#skip-to-content {
Expand All @@ -40,20 +41,21 @@ body {
position: absolute;
overflow: hidden;
top: -10px;
border-radius: 1px;

&:focus {
position: fixed;
top: 10px;
left: 10px;
height: auto;
width: auto;
background: invert($body-link-color);
outline: thick solid invert($body-link-color);
background: var(--body-link-color);
outline: solid var(--body-link-color);
}
}

a {
color: $body-link-color;
color: var(--body-link-color);
text-decoration: none;

&:hover {
Expand Down Expand Up @@ -106,10 +108,10 @@ a {
}

.page-header {
color: $header-heading-color;
color: var(--header-heading-color);
text-align: center;
background-color: $header-bg-color;
background-image: linear-gradient(120deg, $header-bg-color-secondary, $header-bg-color);
background-color: var(--header-bg-color);
background-image: linear-gradient(120deg, var(--header-bg-color-secondary), var(--header-bg-color));

@include large {
padding: 5rem 6rem;
Expand Down Expand Up @@ -210,7 +212,7 @@ a {
margin-top: 2rem;
margin-bottom: 1rem;
font-weight: normal;
color: $section-headings-color;
color: var(--section-headings-color);
}

p {
Expand All @@ -221,8 +223,8 @@ a {
padding: 2px 4px;
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
font-size: 0.9rem;
color: $code-text-color;
background-color: $code-bg-color;
color: var(--code-text-color);
background-color: var(--code-bg-color);
border-radius: 0.3rem;
}

Expand All @@ -231,17 +233,17 @@ a {
margin-top: 0;
margin-bottom: 1rem;
font: 1rem Consolas, "Liberation Mono", Menlo, Courier, monospace;
color: $code-text-color;
color: var(--code-text-color);
word-wrap: normal;
background-color: $code-bg-color;
border: solid 1px $border-color;
background-color: var(--code-bg-color);
border: solid 1px var(--border-color);
border-radius: 0.3rem;

> code {
padding: 0;
margin: 0;
font-size: 0.9rem;
color: $code-text-color;
color: var(--code-text-color);
word-break: normal;
white-space: pre;
background: transparent;
Expand Down Expand Up @@ -294,8 +296,8 @@ a {
blockquote {
padding: 0 1rem;
margin-left: 0;
color: $blockquote-text-color;
border-left: 0.3rem solid $border-color;
color: var(--blockquote-text-color);
border-left: 0.3rem solid var(--border-color);

> :first-child {
margin-top: 0;
Expand All @@ -321,7 +323,7 @@ a {
th,
td {
padding: 0.5rem 1rem;
border: 1px solid $table-border-color;
border: 1px solid var(--table-border-color);
}
}

Expand All @@ -345,15 +347,15 @@ a {
height: 2px;
padding: 0;
margin: 1rem 0;
background-color: $hr-border-color;
background-color: var(--hr-border-color);
border: 0;
}
}

.site-footer {
padding-top: 2rem;
margin-top: 2rem;
border-top: solid 1px $hr-border-color;
border-top: solid 1px var(--hr-border-color);

@include large {
font-size: 1rem;
Expand All @@ -374,5 +376,5 @@ a {
}

.site-footer-credits {
color: $blockquote-text-color;
color: var(--blockquote-text-color);
}
Loading