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

[Feature] Accessible Media Query Styles #115

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
- **Contact form** built in using [Formspree](https://formspree.io/) or [Netlify Forms](https://www.netlify.com/features/#forms)
- Designed with **[Siteleaf](http://www.siteleaf.com/)** in mind
- Has 9 of the most popular networks as performant sharing buttons
- Built in "dark mode" and reduced motion styles for a more accessible experience
- Has documentation

## Examples
Expand Down
62 changes: 62 additions & 0 deletions _sass/_syntax.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,65 @@
.vg { color: #008080 } /* Name.Variable.Global */
.vi { color: #008080 } /* Name.Variable.Instance */
.il { color: #009999 } /* Literal.Number.Integer.Long */

@media (prefers-color-scheme: dark) {
.hll { background-color: #272822; }
.c { color: #75715e } /* Comment */
.err { color: #960050; background-color: #1e0010 } /* Error */
.k { color: #66d9ef } /* Keyword */
.l { color: #ae81ff } /* Literal */
.n { color: #f8f8f2 } /* Name */
.o { color: #f92672 } /* Operator */
.p { color: #f8f8f2 } /* Punctuation */
.cm { color: #75715e } /* Comment.Multiline */
.cp { color: #75715e } /* Comment.Preproc */
.c1 { color: #75715e } /* Comment.Single */
.cs { color: #75715e } /* Comment.Special */
.ge { font-style: italic } /* Generic.Emph */
.gs { font-weight: bold } /* Generic.Strong */
.kc { color: #66d9ef } /* Keyword.Constant */
.kd { color: #66d9ef } /* Keyword.Declaration */
.kn { color: #f92672 } /* Keyword.Namespace */
.kp { color: #66d9ef } /* Keyword.Pseudo */
.kr { color: #66d9ef } /* Keyword.Reserved */
.kt { color: #66d9ef } /* Keyword.Type */
.ld { color: #e6db74 } /* Literal.Date */
.m { color: #ae81ff } /* Literal.Number */
.s { color: #e6db74 } /* Literal.String */
.na { color: #a6e22e } /* Name.Attribute */
.nb { color: #f8f8f2 } /* Name.Builtin */
.nc { color: #a6e22e } /* Name.Class */
.no { color: #66d9ef } /* Name.Constant */
.nd { color: #a6e22e } /* Name.Decorator */
.ni { color: #f8f8f2 } /* Name.Entity */
.ne { color: #a6e22e } /* Name.Exception */
.nf { color: #a6e22e } /* Name.Function */
.nl { color: #f8f8f2 } /* Name.Label */
.nn { color: #f8f8f2 } /* Name.Namespace */
.nx { color: #a6e22e } /* Name.Other */
.py { color: #f8f8f2 } /* Name.Property */
.nt { color: #f92672 } /* Name.Tag */
.nv { color: #f8f8f2 } /* Name.Variable */
.ow { color: #f92672 } /* Operator.Word */
.w { color: #f8f8f2 } /* Text.Whitespace */
.mf { color: #ae81ff } /* Literal.Number.Float */
.mh { color: #ae81ff } /* Literal.Number.Hex */
.mi { color: #ae81ff } /* Literal.Number.Integer */
.mo { color: #ae81ff } /* Literal.Number.Oct */
.sb { color: #e6db74 } /* Literal.String.Backtick */
.sc { color: #e6db74 } /* Literal.String.Char */
.sd { color: #e6db74 } /* Literal.String.Doc */
.s2 { color: #e6db74 } /* Literal.String.Double */
.se { color: #ae81ff } /* Literal.String.Escape */
.sh { color: #e6db74 } /* Literal.String.Heredoc */
.si { color: #e6db74 } /* Literal.String.Interpol */
.sx { color: #e6db74 } /* Literal.String.Other */
.sr { color: #e6db74 } /* Literal.String.Regex */
.s1 { color: #e6db74 } /* Literal.String.Single */
.ss { color: #e6db74 } /* Literal.String.Symbol */
.bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
.vc { color: #f8f8f2 } /* Name.Variable.Class */
.vg { color: #f8f8f2 } /* Name.Variable.Global */
.vi { color: #f8f8f2 } /* Name.Variable.Instance */
.il { color: #ae81ff } /* Literal.Number.Integer.Long */
}
101 changes: 92 additions & 9 deletions _sass/_theme.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
// Mixins
@mixin reducedMotion {
@media (prefers-reduced-motion: reduce) {
@content;
transition: none;
}
}

@mixin darkMode {
@media (prefers-color-scheme: dark) {
@content;
}
}

// Root
html {
scroll-behavior: smooth;
@include reducedMotion {
scroll-behavior: auto;
}
}


// Structural elements
body {
background: $backgroundColour;
Expand All @@ -6,6 +29,10 @@ body {
display: flex;
@include flex-direction(column);
overflow-x: hidden;
@include darkMode {
background: invert($backgroundColour, 100%);
color: invert($bodyColour, 100%);
}
}

.container {
Expand Down Expand Up @@ -48,9 +75,24 @@ body {
margin-bottom: 1.6rem;
text-align: center;
background: $featureBackgroundColour;
@include darkMode {
position: relative;
&::after {
content: "";
z-index: 0;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
background: fade-out(invert($featureBackgroundColour, 100%), 0.5);
}
}
background-size: cover;
background-position: center;
.container {
position: relative;
z-index: 1;
min-height: 35vh;
max-width: 60%;
@include flex-direction(column);
Expand Down Expand Up @@ -82,6 +124,9 @@ body {
.small {
padding-top: .8rem;
color: $captionColour;
@include darkMode {
color: invert($captionColour, 100%);
}
display: inline-block;
}

Expand All @@ -100,15 +145,28 @@ body {
.small {
padding-top: 0;
}
@include darkMode {
background: invert($headingColour, 100%);
color: invert($captionColour, 100%);
a {
color: invert($captionColour, 100%);
&:hover {
color: invert($backgroundColour, 100%);
}
}
}
}


// Pagination nav
.nav--paginator {
@include flexbox;
@include justify-content(space-between);
color: $captionColour;
text-align: center;
color: $captionColour;
@include darkMode {
color: invert($captionColour, 100%);
}
}

.pagination {
Expand Down Expand Up @@ -152,6 +210,7 @@ body {
@include flex(1, 0, auto);
opacity: 0.5;
transition: opacity .1s;
@include reducedMotion {}
.section {
position: sticky;
top: 0;
Expand All @@ -177,6 +236,8 @@ body {
list-style: none;
&--nav {
overflow: hidden;
transition: .2s;
@include reducedMotion {}
margin-bottom: var(--listHeight, 0);
}
.item--post,
Expand Down Expand Up @@ -205,8 +266,12 @@ body {


// Links, icons and images
a {
@include reducedMotion {}
}
a .icon {
transition: fill .1s;
@include reducedMotion {}
&:hover {
fill: currentColor;
}
Expand Down Expand Up @@ -279,6 +344,9 @@ video {
&__legend {
font-style: italic;
color: $captionColour;
@include darkMode {
color: invert($captionColour, 100%);
}
position: absolute;
overflow: hidden;
right: 0;
Expand All @@ -298,6 +366,7 @@ select {
padding: .6rem 1.2rem;
margin-bottom: .6rem;
transition: color .1s, background-color .1s, border .1s;
@include reducedMotion {}
line-height: inherit;
border: none;
box-shadow: none;
Expand All @@ -316,6 +385,7 @@ button,
color: $backgroundColour;
background: $accentColour;
transition: box-shadow .1s;
@include reducedMotion {}
will-change: box-shadow;
box-shadow: inset 0 0 0 2rem transparent;
&:hover {
Expand Down Expand Up @@ -371,14 +441,18 @@ select {
&:hover {
border-color: $bodyColour;
}
@include darkMode {
background: invert($backgroundColour, 100%);
color: invert($bodyColour, 100%);
}
}

select {
background: $codeBackgroundColour;
}

textarea {
resize: vertical;
resize: vertical;
}

label {
Expand All @@ -387,7 +461,6 @@ label {

code {
padding: .12rem .2rem;
color: $headingColour;
}

pre code {
Expand All @@ -414,24 +487,23 @@ pre code {
::selection {
background: $headingColour;
color: $backgroundColour;
@include darkMode {
background: invert($headingColour, 100%);
color: invert($backgroundColour, 100%);
}
text-shadow: none;
}


// Sassline overrides
.typeset {
a > code {
text-shadow: none;
}
.button,
button {
background-image: none;
text-shadow: none;
color: $backgroundColour;
text-decoration: none;
&:hover,
&:active,
&:focus {
background-image: none;
color: $backgroundColour;
}
}
Expand All @@ -454,4 +526,15 @@ pre code {
white-space: pre;
overflow-x: scroll;
}
@include darkMode {
pre,
code,
h1, h2, h3, h4, h5, h6 {
color: invert($headingColour, 100%);
}
pre,
code {
background: invert($backgroundColour, 90%);
}
}
}
16 changes: 4 additions & 12 deletions _sass/sassline-base/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,10 @@ a {

// Nice underlines for text links.
p a, li a {
background-image: linear-gradient(to bottom,rgba(0, 0, 0, 0) 50%,$linkColour 50%);
background-position: 0 93%;
background-repeat: repeat-x;
background-size: 100% 0.15rem;
text-shadow: 0.1rem 0 $backgroundColour,
0.15rem 0 $backgroundColour,
-0.1rem 0 $backgroundColour,
-0.15rem 0 $backgroundColour;

&:hover, &:active, &:focus {
background-image: linear-gradient(to bottom,rgba(0, 0, 0, 0) 50%,$hoverColour 50%);
}
text-decoration: underline;
text-decoration-skip-ink: auto;
-webkit-text-decoration-skip: ink;
text-decoration-skip: ink;
}

// Paragraphs. OpenType ligatures and oldstyle figures enabled if available.
Expand Down
12 changes: 6 additions & 6 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ Alembic is a starting point for [Jekyll](https://jekyllrb.com/) projects. Rather
- **Contact form** built in using [Formspree](https://formspree.io/)
- Designed with **[Siteleaf](https://www.siteleaf.com/)** in mind
- Has 9 of the most popular networks as performant sharing buttons
- Built in "dark mode" and reduced motion styles for a more accessible experience
- Has documentation

## Examples

Here are a few examples of Alembic out in the wild being used in a variety of ways:

- [bitpodcast.com](https://bitpodcast.com/)
- [joelcagedesign.com](https://joelcagedesign.com/)
- [bawejakunal.github.io](https://bawejakunal.github.io/)
- [trenki2.github.io](https://trenki2.github.io/)
- [overtonestudio.github.io](https://overtonestudio.github.io/)
- [isaacsmith.github.io](https://isaacsmith.github.io/)
- [karateca.org](http://www.karateca.org/)
- [lillianpetersen.github.io](https://lillianpetersen.github.io/)
- [case2111.github.io](https://case2111.github.io/)
- [www.10people.co.uk](https://www.10people.co.uk/)
- [hrkeni.me](https://hrkeni.me/)
- [ccs17.bsc.es](https://ccs17.bsc.es/)
- [karateca.org](https://www.karateca.org/)

## Installation

Expand Down