Skip to content

Commit 919580e

Browse files
committed
hover box default dark line -> #444 not black.
1 parent 4ab7986 commit 919580e

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/components/color/index.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ var color = module.exports = {};
1616

1717
var colorAttrs = require('./attributes');
1818
color.defaults = colorAttrs.defaults;
19-
color.defaultLine = colorAttrs.defaultLine;
19+
var defaultLine = color.defaultLine = colorAttrs.defaultLine;
2020
color.lightLine = colorAttrs.lightLine;
21-
color.background = colorAttrs.background;
21+
var background = color.background = colorAttrs.background;
2222

2323
/*
2424
* tinyRGB: turn a tinycolor into an rgb string, but
@@ -47,7 +47,7 @@ color.combine = function(front, back) {
4747
var fc = tinycolor(front).toRgb();
4848
if(fc.a === 1) return tinycolor(front).toRgbString();
4949

50-
var bc = tinycolor(back || color.background).toRgb(),
50+
var bc = tinycolor(back || background).toRgb(),
5151
bcflat = bc.a === 1 ? bc : {
5252
r: 255 * (1 - bc.a) + bc.r * bc.a,
5353
g: 255 * (1 - bc.a) + bc.g * bc.a,
@@ -68,16 +68,15 @@ color.combine = function(front, back) {
6868
*
6969
* If lightAmount / darkAmount are used, we adjust by these percentages,
7070
* otherwise we go all the way to white or black.
71-
* TODO: black is what we've always done for hover, but should it be #444 instead?
7271
*/
7372
color.contrast = function(cstr, lightAmount, darkAmount) {
7473
var tc = tinycolor(cstr);
7574

76-
if(tc.getAlpha() !== 1) tc = tinycolor(color.combine(cstr, '#fff'));
75+
if(tc.getAlpha() !== 1) tc = tinycolor(color.combine(cstr, background));
7776

7877
var newColor = tc.isDark() ?
79-
(lightAmount ? tc.lighten(lightAmount) : '#fff') :
80-
(darkAmount ? tc.darken(darkAmount) : '#000');
78+
(lightAmount ? tc.lighten(lightAmount) : background) :
79+
(darkAmount ? tc.darken(darkAmount) : defaultLine);
8180

8281
return newColor.toString();
8382
};

0 commit comments

Comments
 (0)