-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdarkthemecode.js
53 lines (44 loc) · 1.51 KB
/
darkthemecode.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//TODOs:
// 1. Write the script tag pulling in tinycolor in js.
//Function to perform the DarkTheme operation
var craigify = function() {
$('*').each(function() {
var descentLevel = $(this).parents().length;
descentLevel *= 15;
var color = 'rgb(' + descentLevel + ',' + descentLevel + ',' + descentLevel + ')';
if($(this).css('background-color') != 'transparent'
) {
$(this).css('background-color', color);
}
$(this).css('border-color','black');
$(this).css('border-style', 'sold');
$(this).css('border-weight', '20px');
$(this).css('color', 'white');
});
};
var greyscale = function () {
$('*').each(function() {
if($(this).css('background-color') != 'transparent' &&
$(this).css('background-color') != undefined) {
//Create a tinycolor object of the current element
var color = new tinycolor($(this).css('background-color'))
//Greyscale color
color = color.greyscale();
//push the greyscale color back to the element
$(this).css('background-color', color.toString());
}
});
};
//Function to take in a JQUERY object and greyscale it.
var greyscaleElement = function(element)
{
if($(element).css('background-color') != 'transparent' &&
$(this).css('background-color') != undefined) {
//Create a tinycolor object of the current element
var color = new tinycolor($(this).css('background-color'))
//Greyscale color
color = color.greyscale();
//push the greyscale color back to the element
$(this).css('background-color', color.toString());
}
};