Skip to content

Commit c489493

Browse files
Add adaptive skin: solarized (#594)
Merge pull request 594
1 parent 14d0f53 commit c489493

File tree

4 files changed

+82
-10
lines changed

4 files changed

+82
-10
lines changed

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
***Disclaimer:** The information here may vary depending on the version you're using. Please refer to the `README.md` bundled
66
within the theme-gem for information specific to your version or by pointing your browser to the Git tag corresponding to your
7-
version. e.g. https://github.com/jekyll/minima/blob/v2.5.0/README.md*
7+
version. e.g. https://github.com/jekyll/minima/blob/v2.5.0/README.md*
88
*Running `bundle show minima` will provide you with the local path to your current theme version.*
99

1010

@@ -174,10 +174,16 @@ Minima 2.0 | Minima 3.0
174174

175175
##### Available skins
176176

177-
- classic
178-
- dark
179-
- solarized
180-
- solarized-dark
177+
Skin setting | Description
178+
--------------- | -----------
179+
classic | Default, light color scheme.
180+
dark | Dark variant of the classic skin.
181+
solarized | *Adaptive skin* for [solarized](https://github.com/solarized) color scheme skins.
182+
solarized-light | Light variant of solarized color scheme.
183+
solarized-dark | Dark variant of solarized color scheme.
184+
185+
*:bulb: Adaptive skins switch between the "light" and "dark" variants based on the user's operating system setting or browser setting
186+
(via CSS Media Query [prefers-color-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)).*
181187

182188
### Customize navigation links
183189

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@charset "utf-8";
22

3+
$sol-is-auto: false;
34
$sol-is-dark: true;
45
@import "minima/skins/solarized";
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@charset "utf-8";
2+
3+
$sol-is-auto: false;
4+
@import "minima/skins/solarized";

_sass/minima/skins/solarized.scss

Lines changed: 66 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
// Created by Sander Voerman <mailto:[email protected]> using the Solarized
66
// color scheme by Ethan Schoonover <https://ethanschoonover.com/solarized>.
77

8-
// This style sheet implements two options for the minima.skin setting:
9-
// "solarized" for light mode and "solarized-dark" for dark mode.
8+
// This style sheet implements three options for the minima.skin setting:
9+
// "solarized-light" for light mode, "solarized-dark" for dark mode, and
10+
// "solarized" for light or dark mode depending on user preference.
11+
$sol-is-auto: true !default;
1012
$sol-is-dark: false !default;
1113

1214

@@ -31,26 +33,85 @@ $sol-blue: #268bd2; // 55 -10 -45
3133
$sol-cyan: #2aa198; // 60 -35 -05
3234
$sol-green: #859900; // 60 -20 65
3335

36+
37+
// Mixed colors
38+
// ------------
39+
// While not part of the original Solarized base tones, these derived tones
40+
// are meant to replicate the visual style of the classic skin. They should
41+
// not be used in cases where sufficiently contrasting colors are needed.
42+
43+
$sol-light-mix1: mix($sol-base1, $sol-base3);
44+
$sol-light-mix2: mix($sol-blue, $sol-base00);
45+
$sol-light-mix3: mix($sol-base2, $sol-base3);
46+
$sol-dark-mix1: mix($sol-base01, $sol-base03);
47+
$sol-dark-mix2: mix($sol-blue, $sol-base0);
48+
$sol-dark-mix3: mix($sol-base02, $sol-base03);
49+
50+
51+
// Mode selection
52+
// --------------
53+
3454
$sol-mono3: $sol-base3;
3555
$sol-mono2: $sol-base2;
3656
$sol-mono1: $sol-base1;
3757
$sol-mono00: $sol-base00;
3858
$sol-mono01: $sol-base01;
59+
$sol-mix1: $sol-light-mix1;
60+
$sol-mix2: $sol-light-mix2;
61+
$sol-mix3: $sol-light-mix3;
3962

4063
@if $sol-is-dark {
4164
$sol-mono3: $sol-base03;
4265
$sol-mono2: $sol-base02;
4366
$sol-mono1: $sol-base01;
4467
$sol-mono00: $sol-base0;
4568
$sol-mono01: $sol-base1;
69+
$sol-mix1: $sol-dark-mix1;
70+
$sol-mix2: $sol-dark-mix2;
71+
$sol-mix3: $sol-dark-mix3;
72+
}
73+
74+
@if $sol-is-auto {
75+
:root {
76+
--solarized-mono3: #{$sol-base3};
77+
--solarized-mono2: #{$sol-base2};
78+
--solarized-mono1: #{$sol-base1};
79+
--solarized-mono00: #{$sol-base00};
80+
--solarized-mono01: #{$sol-base01};
81+
--solarized-mix1: #{$sol-light-mix1};
82+
--solarized-mix2: #{$sol-light-mix2};
83+
--solarized-mix3: #{$sol-light-mix3};
84+
}
85+
86+
@media (prefers-color-scheme: dark) {
87+
:root {
88+
--solarized-mono3: #{$sol-base03};
89+
--solarized-mono2: #{$sol-base02};
90+
--solarized-mono1: #{$sol-base01};
91+
--solarized-mono00: #{$sol-base0};
92+
--solarized-mono01: #{$sol-base1};
93+
--solarized-mix1: #{$sol-dark-mix1};
94+
--solarized-mix2: #{$sol-dark-mix2};
95+
--solarized-mix3: #{$sol-dark-mix3};
96+
}
97+
}
98+
99+
$sol-mono3: var(--solarized-mono3);
100+
$sol-mono2: var(--solarized-mono2);
101+
$sol-mono1: var(--solarized-mono1);
102+
$sol-mono00: var(--solarized-mono00);
103+
$sol-mono01: var(--solarized-mono01);
104+
$sol-mix1: var(--solarized-mix1);
105+
$sol-mix2: var(--solarized-mix2);
106+
$sol-mix3: var(--solarized-mix3);
46107
}
47108

48109

49110
// Minima color variables
50111
// ----------------------
51112

52113
$brand-color: $sol-mono1 !default;
53-
$brand-color-light: mix($sol-mono1, $sol-mono3) !default;
114+
$brand-color-light: $sol-mix1 !default;
54115
$brand-color-dark: $sol-mono00 !default;
55116

56117
$site-title-color: $sol-mono00 !default;
@@ -60,15 +121,15 @@ $background-color: $sol-mono3 !default;
60121
$code-background-color: $sol-mono2 !default;
61122

62123
$link-base-color: $sol-blue !default;
63-
$link-visited-color: mix($sol-blue, $sol-mono00) !default;
124+
$link-visited-color: $sol-mix2 !default;
64125
$link-hover-color: $sol-mono00 !default;
65126

66127
$border-color-01: $brand-color-light !default;
67128
$border-color-02: $sol-mono1 !default;
68129
$border-color-03: $sol-mono00 !default;
69130

70131
$table-text-color: $sol-mono00 !default;
71-
$table-zebra-color: mix($sol-mono2, $sol-mono3) !default;
132+
$table-zebra-color: $sol-mix3 !default;
72133
$table-header-bg-color: $sol-mono2 !default;
73134
$table-header-border: $sol-mono1 !default;
74135
$table-border-color: $sol-mono1 !default;

0 commit comments

Comments
 (0)