Skip to content

Commit 877b242

Browse files
committed
Compatibility with dark mode in K5. Closes #55
1 parent d869f7c commit 877b242

File tree

13 files changed

+144
-127
lines changed

13 files changed

+144
-127
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Matomo helpers, panel area and sections for Kirby",
44
"type": "kirby-plugin",
55
"license": "MIT",
6-
"version": "2.1.0",
6+
"version": "2.1.1",
77
"authors": [
88
{
99
"name": "Sylvain Julé",

index.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/assets/css/common/_typography.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
text-transform: uppercase;
44
font-size: 0.75rem;
55
letter-spacing: 0.15px;
6-
color: lighten($grey, 10%);
6+
color: light-dark(lighten($grey, 10%), rgba(255, 255, 255, .55));
77
font-weight: 400;
88
}
99
.empty {
@@ -12,6 +12,6 @@
1212
text-align: center;
1313
margin-top: 1rem;
1414
padding: 1rem 0 1rem 0;
15-
background: #fafafa;
15+
background: light-dark(#fafafa, hsl(0, 0%, calc(15% + 0%)));
1616
}
1717
}

src/assets/css/components/_chart.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
left: 0;
99
width: 100%;
1010
height: 100%;
11-
background: rgba(239, 239, 239, 0.85);
11+
background: light-dark(rgba(239, 239, 239, 0.85), rgba(31, 31, 31, .85));
1212
z-index: 1000;
1313
display: flex;
1414
justify-content: center;
@@ -21,14 +21,14 @@
2121
.empty {
2222
margin-top: 0;
2323
padding: 1rem;
24-
background: white;
24+
background: light-dark(white, black);
2525
span {
2626
display: flex;
2727
align-items: center;
2828
justify-content: center;
2929
width: 100%;
3030
height: 100%;
31-
background: #fafafa;
31+
background: light-dark(#fafafa, hsl(0, 0%, calc(19% + 0%)));
3232
color: #b3b3b3;
3333
}
3434
}

src/assets/css/components/_overview.scss

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
margin-top: 1.5rem;
99
padding: 1.5rem;
1010
padding-right: 1rem;
11-
background: white;
11+
background: light-dark(white, hsl(0, 0%, calc(19% + 0%)));
12+
border-radius: var(--rounded);
1213
min-height: 150px;
1314
display: flex;
1415
box-shadow: 0 2px 5px rgba(22,23,26,.05);
@@ -20,7 +21,7 @@
2021
justify-content: space-between;
2122
align-items: flex-start;
2223
&:not(:last-child) {
23-
border-right: 1px solid lighten(#d9d9d9, 7%);
24+
border-right: 1px solid light-dark(lighten(#d9d9d9, 7%), rgba(255, 255, 255, .2));
2425
padding-right: 1rem;
2526
margin-right: 1.5rem;
2627
}
@@ -41,7 +42,7 @@
4142
content: '';
4243
width: 15px;
4344
height: 1px;
44-
background: lighten($grey, 20%);
45+
background: light-dark(lighten($grey, 20%), rgba(255, 255, 255, .3));
4546
top: 0;
4647
}
4748
}
@@ -63,7 +64,7 @@
6364
}
6465
}
6566
&.positive {
66-
background: #f1faed;
67+
background: light-dark(#f1faed, rgba(#405b34, .4));
6768
color: #7aba4c;
6869
.icon {
6970
svg {
@@ -72,8 +73,8 @@
7273
}
7374
}
7475
&.negative {
75-
background: #feeaee;
76-
color: #f93048;
76+
background: light-dark(#feeaee, rgba(#963a4c, .3));
77+
color: light-dark(#f93048, #eb475b);
7778
.icon {
7879
transform: rotate(90deg);
7980
svg {
@@ -82,8 +83,8 @@
8283
}
8384
}
8485
&.grey {
85-
background: lighten(#efefef, 3%);
86-
color: #9a9a9a;
86+
background: light-dark(lighten(#efefef, 3%), rgba(255, 255, 255, .07));
87+
color: light-dark(#9a9a9a, rgba(255, 255, 255, .6));
8788
}
8889
}
8990
}
@@ -112,14 +113,14 @@
112113
border-right: none;
113114
}
114115
&:nth-child(odd) {
115-
border-right: 1px solid lighten(#d9d9d9, 7%);
116+
border-right: 1px solid light-dark(lighten(#d9d9d9, 7%), rgba(255, 255, 255, .2));
116117
}
117118
&:nth-child(even) {
118119
padding-left: 1.5rem;
119120
}
120121
&:first-child, &:nth-child(2) {
121122
padding-bottom: 1.5rem;
122-
border-bottom: 1px solid lighten(#d9d9d9, 7%);
123+
border-bottom: 1px solid light-dark(lighten(#d9d9d9, 7%), rgba(255, 255, 255, .2));
123124
}
124125
&:nth-child(3), &:nth-child(4) {
125126
padding-top: 1.5rem;
@@ -137,7 +138,7 @@
137138
}
138139
&:not(:last-child) {
139140
padding-bottom: 1.5rem;
140-
border-bottom: 1px solid lighten(#d9d9d9, 7%);
141+
border-bottom: 1px solid light-dark(lighten(#d9d9d9, 7%), rgba(255, 255, 255, .2));
141142
}
142143
&:not(:first-child) {
143144
padding-top: 1.5rem;

src/assets/css/components/_realtime.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
font-size: 0.75rem;
77
padding: 0.25rem 0.5rem;
88
border-radius: 4px;
9-
background: darken(#fafafa, 3%);
9+
background: light-dark(darken(#fafafa, 3%), hsl(0, 0%, calc(15% + 0%)));
1010
letter-spacing: 0.15px;
11-
color: lighten($grey, 5%);
11+
color: light-dark(lighten($grey, 5%), rgba(255, 255, 255, .6));
1212
cursor: pointer;
1313
transition: color 0.2s ease-out;
1414
&:hover {
15-
color: black;
15+
color: light-dark(black, white);
1616
}
1717
}
1818
.big-number {
@@ -32,7 +32,7 @@
3232
content: '';
3333
width: 15px;
3434
height: 1px;
35-
background: lighten($grey, 20%);
35+
background: light-dark(lighten($grey, 20%), rgba(255, 255, 255, .3));
3636
top: 0;
3737
}
3838
}

src/assets/css/components/_visits-summary.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@
1313
svg {
1414
width: 100%;
1515
height: 100%;
16-
fill: lighten($grey, 20%);
16+
fill: light-dark(lighten($grey, 20%), rgba(255, 255, 255, .5));
1717
}
1818
}
1919
.number {
2020
margin-left: auto;
2121
}
2222
&:not(:last-child) {
23-
border-bottom: 1px solid lighten(#d9d9d9, 7%);
23+
border-bottom: 1px solid light-dark(lighten(#d9d9d9, 7%), rgba(255, 255, 255, .2));
2424
}
2525
&:hover {
26-
background: #fafafa;
26+
background: light-dark(#fafafa, hsl(0, 0%, calc(15% + 0%)));
2727
.icon {
2828
svg {
29-
fill: $grey;
29+
fill: light-dark($grey, rgba(255, 255, 255, .8));
3030
}
3131
}
3232
}

src/assets/css/components/_widgets.scss

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
margin-top: 1.5rem;
1515
padding: 1.5rem;
1616
padding-bottom: 1.25rem;
17-
background: white;
17+
background: light-dark(white, hsl(0, 0%, calc(19% + 0%)));
18+
border-radius: var(--rounded);
1819
box-shadow: 0 2px 5px rgba(22,23,26,.05);
1920
&:nth-child(odd) {
2021
margin-right: 1.5rem;
@@ -27,22 +28,7 @@
2728
font-size: 30px;
2829
margin-top: 5px;
2930
}
30-
.details {
31-
position: relative;
32-
font-size: 0.875rem;
33-
color: lighten($grey, 10%);
34-
margin-top: 20px;
35-
padding-top: 15px;
36-
line-height: 1.5;
37-
&:before {
38-
position: absolute;
39-
content: '';
40-
width: 15px;
41-
height: 1px;
42-
background: lighten($grey, 20%);
43-
top: 0;
44-
}
45-
}
31+
4632
ul {
4733
margin-top: calc(20px - 0.5rem);
4834
li {
@@ -58,7 +44,7 @@
5844
svg {
5945
width: 100%;
6046
height: 100%;
61-
fill: lighten($grey, 20%);
47+
fill: light-dark(lighten($grey, 20%), rgba(255, 255, 255, .5));
6248
}
6349
}
6450
.text {
@@ -76,25 +62,26 @@
7662
}
7763
}
7864
&:not(:last-child) {
79-
border-bottom: 1px solid lighten(#d9d9d9, 7%);
65+
border-bottom: 1px solid light-dark(lighten(#d9d9d9, 7%), rgba(255, 255, 255, .2));
8066
}
8167
&:hover {
82-
background: #fafafa;
68+
background: light-dark(#fafafa, hsl(0, 0%, calc(15% + 0%)));
8369
.icon {
8470
svg {
85-
fill: $grey;
71+
fill: light-dark($grey, rgba(255, 255, 255, .8));
8672
}
8773
}
8874
}
8975
}
9076
}
9177
.empty {
92-
color: lighten($grey, 20%);
78+
color: light-dark(lighten($grey, 20%), rgba(255, 255, 255, .6));
9379
font-size: 0.75rem;
9480
text-align: center;
9581
margin-top: 1rem;
9682
padding: 1rem 0 1rem 0;
97-
background: #fafafa;
83+
background: light-dark(#fafafa, hsl(0, 0%, calc(15% + 0%)));
84+
border-radius: var(--rounded-sm);
9885
}
9986
}
10087
@include respond-to('smaller-720') {

src/assets/css/sections/_main.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
opacity: 1;
1515
}
1616
&.active {
17-
border-bottom: 1px solid black;
17+
border-bottom: 1px solid light-dark(black, white);
1818
}
1919
}
2020
@include respond-to('smaller-480') {

0 commit comments

Comments
 (0)