Skip to content

Commit 50e6e41

Browse files
committed
Improve color handling for night mode.
1 parent 566f48c commit 50e6e41

File tree

8 files changed

+97
-41
lines changed

8 files changed

+97
-41
lines changed

assets/themes/dark.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.

dev/sass/controls.scss

Lines changed: 43 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,16 @@
11
%control {
2-
background: rgba($doc-white, 0.25);
32
padding: 0.375rem 0.75rem;
43
font-size: 0.875rem;
54
border-radius: $control-radius;
65
}
76

8-
.controlbar {
9-
display: flex;
10-
padding: 0;
11-
margin: 0; // Firefox injects a 16px margin for some reason without this.
12-
13-
> * {
14-
margin-left: $pad*0.25;
15-
}
16-
}
17-
187
input, textarea {
198
@extend %control;
9+
2010
border-radius: 0;
21-
background: rgba($white, 0.05);
11+
background: rgba($white, $input-opacity);
2212
border: none;
23-
border-bottom: solid 1px rgba($white, 0.05);
13+
border-bottom: solid 1px rgba($white, $input-opacity);
2414
font-family: $font-family;
2515
font-size: 1rem;
2616
display: block;
@@ -77,11 +67,14 @@ svg.icon {
7767

7868
.control {
7969
@extend %control;
70+
71+
background: rgba($white, $control-opacity);
8072
}
8173

82-
.button {
74+
.button, .buttonbar > *, .segcontrol > * {
8375
@extend %control;
8476

77+
background: rgba($white, $button-opacity);
8578
display: inline-block;
8679
cursor: pointer;
8780
transition: background-color $transition-t ease-out;
@@ -95,12 +88,12 @@ svg.icon {
9588
color: $black;
9689

9790
&:hover {
98-
background: $doc-white;
91+
background: $white;
9992
}
10093
}
10194

10295
&:hover, &.selected {
103-
background: rgba($doc-white, 0.75);
96+
background: rgba($white, $button-hover-opacity);
10497

10598
> svg.icon.dropdown {
10699
margin-top: 0.5em;
@@ -128,24 +121,43 @@ svg.icon {
128121
}
129122
}
130123

131-
.segcontrol {
132-
@extend .controlbar;
133-
> * {
134-
@extend .button;
135-
margin-left: 1px;
136-
border-radius: 0;
137-
display: inline-block;
138-
139-
&:first-child {
140-
border-radius: $control-radius 0 0 $control-radius;
141-
}
142-
143-
&:last-child {
144-
border-radius: 0 $control-radius $control-radius 0;
145-
}
124+
.controlbar, .buttonbar, .segcontrol {
125+
display: flex;
126+
padding: 0;
127+
margin: 0; // Firefox injects a 16px margin for some reason without this.
128+
129+
> * {
130+
margin-left: $pad*0.25;
146131
}
147132
}
148133

134+
.buttonbar, .segcontrol {
135+
> * {
136+
margin-left: 1px;
137+
border-radius: 0;
138+
display: inline-block;
139+
140+
&:first-child {
141+
border-radius: $control-radius 0 0 $control-radius;
142+
}
143+
144+
&:last-child {
145+
border-radius: 0 $control-radius $control-radius 0;
146+
}
147+
}
148+
}
149+
150+
.segcontrol > * {
151+
&:first-child {
152+
border-radius: $control-radius 0 0 $control-radius;
153+
}
154+
155+
&:last-child {
156+
border-radius: 0 $control-radius $control-radius 0;
157+
}
158+
}
159+
160+
149161

150162
.tooltip {
151163
display: flex;

dev/sass/variables.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ $control-radius: 0.125rem;
33
$input-height: 3.75rem;
44
$title-height: 2.5rem;
55
$transition-t: 0.2s;
6+
7+
$control-opacity: 0.2;
8+
$button-opacity: 0.35;
9+
$input-opacity: 0.05;
10+
$button-hover-opacity: 0.75;
611
$disabled-opacity: 0.35;
712

813
$related-stroke-width: 1px;

dev/sass/views/doc.scss

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,26 @@
5151
}
5252
}
5353
}
54+
55+
// overwrite colors:
56+
input, textarea {
57+
background: rgba($doc-white, $input-opacity);
58+
border-color: rgba($doc-white, $input-opacity);
59+
}
60+
61+
.control {
62+
background: rgba($doc-white, $control-opacity);
63+
}
64+
65+
.button, .buttonbar > *, .segcontrol > * {
66+
background: rgba($doc-white, $button-opacity);
67+
68+
&:hover, &.selected {
69+
background: rgba($doc-white, $button-hover-opacity);
70+
}
71+
72+
&.default:hover {
73+
background: $doc-white;
74+
}
75+
}
5476
}

dev/sass/views/expression.scss

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@
3333
#tooltip-flavor, #tooltip-flags {
3434
> .list {
3535
li {
36-
@extend %link;
37-
36+
cursor: pointer;
3837
color: $doc-light;
38+
39+
&:hover {
40+
color: $doc-white;
41+
}
3942

4043
+ li {
4144
margin-top: 0.5em;

dev/sass/views/header.scss

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,22 @@
112112
@extend .button;
113113
margin: $pad*0.25 0;
114114
padding: $pad*0.625;
115+
color: $lightest;
115116

116-
background: $dark;
117117
opacity: 0.85;
118118
&:hover {
119-
background: $dark;
120119
opacity: 1;
121120
}
122121

122+
&[data-id='GitHub'] {
123+
background: #777777 !important;
124+
}
125+
123126
&[data-id='Facebook'] {
124-
background: #4267B2;
127+
background: #4267B2 !important;
125128
}
126129
&[data-id='Google'] {
127-
background: #C94130;
130+
background: #C94130 !important;
128131
}
129132

130133
>svg.icon {
@@ -136,7 +139,12 @@
136139
display: none;
137140

138141
.signoutbtn {
139-
@extend %link;
142+
cursor: pointer;
143+
color: $theme-color;
144+
145+
&:hover {
146+
color: $doc-white;
147+
}
140148
}
141149
}
142150

dev/sass/views/text.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
}
6262
}
6363

64-
#tooltip {
64+
#tooltip .texthover {
6565
.more {
6666
display: inline-block;
6767
color: $doc-light;

dev/src/views/TextHover.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
1717
*/
1818

1919
import CMUtils from "../utils/CMUtils";
20+
import $ from "../utils/DOMUtils";
2021

2122
import app from "../app";
2223

@@ -61,6 +62,11 @@ export default class TextHover {
6162
}
6263
let rect = (index != null) && CMUtils.getCharRect(cm, index);
6364
if (rect) { rect.right = rect.left = x; }
64-
app.tooltip.hover.show("TextHover", app.reference.tipForMatch(match, cm.getValue()), x, rect.bottom, true, 0);
65+
let tip = app.reference.tipForMatch(match, cm.getValue());
66+
if (tip) {
67+
let div = $.create("div", "texthover", tip);
68+
app.tooltip.hover.show("TextHover", div, x, rect.bottom, true, 0);
69+
}
70+
6571
}
6672
}

0 commit comments

Comments
 (0)