-
Notifications
You must be signed in to change notification settings - Fork 48
/
index.html
183 lines (180 loc) · 7.8 KB
/
index.html
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>LSCOLORS Generator</title>
<meta name="author" content="Geoff Greer" />
<meta name="viewport" content="width=760" />
<link type="text/css" href="lscolors.css" rel="stylesheet" />
<link id="main-css" rel="stylesheet" type="text/css" media="all" href="/styles/main.css" />
<script type="text/javascript" src="lscolors.js">
</script>
</head>
<body onload="makePreview()">
<script type="text/javascript">
//<![CDATA[
var _gaq = _gaq || [];
var main_css = document.getElementById("main-css");
var styles = {
light: ["Light", "", "/styles/main.css", "/styles/solarized-light.css"],
dark: ["Dark", "#000", "/styles/main-inverted.css", "/styles/solarized-dark.css"]
};
function set_style(style) {
var date = new Date();
_gaq.push(["_setCustomVar", 1, "Color", style[0], 1]);
document.body.style.background = style[1];
main_css.attributes.href.value = style[2];
date.setTime(date.getTime() + 30 * 24 * 60 * 60 * 1000);
document.cookie = "main-css=" + main_css.attributes.href.value + "; expires=" + date.toGMTString() + "; path=/";
return style;
}
function set_colors() {
var i, cookies, key, value;
cookies = document.cookie.split("; ");
for (i = 0; i < cookies.length; i++) {
key = cookies[i].split("=")[0];
value = cookies[i].split("=")[1];
if (key === "main-css" && value === "/styles/main-inverted.css") {
set_style(styles.dark);
}
}
if (window.location.hash.slice(1) === "dark") {
set_style(styles.dark);
} else if (window.location.hash.slice(1) === "light") {
set_style(styles.light);
}
}
function invert_colors() {
var style = main_css.attributes.href.value === "/styles/main.css" ? set_style(styles.dark) : set_style(styles.light);
_gaq.push(["_trackEvent", "Color", "Set style", style[0]]);
}
set_colors();
//]]>
</script>
<div id="wrapper">
<hr />
<br />
<table style="background-color: #aaa; border: thin dotted #555; margin: 0px auto;">
<tr>
<td>
<div class="graybox" style="text-align: right">
File type:
</div>
</td>
<td>
<div class="colorPicker">
<select id="currentColorIndex" onchange="updateColorIndex()">
<option value="0">Directory</option>
<option value="1">Symbolic link</option>
<option value="2">Socket</option>
<option value="3">Pipe</option>
<option value="4">Executable</option>
<option value="5">Block special</option>
<option value="6">Character special</option>
<option value="7">Setuid Executable</option>
<option value="8">Setgid Executable</option>
<option value="9">Directory writable to others, with sticky bit</option>
<option value="10">Directory writable to others, no sticky bit</option>
</select>
</div>
</td>
<td></td>
</tr>
<tr>
<td>
<div class="graybox" style="text-align: right">
Foreground:
</div>
</td>
<td>
<div class="colorPicker">
<img alt="Black" width="20" height="20" src="black.png" onclick="changeColor('a',0)" />
<img alt="Red" width="20" height="20" src="red.png" onclick="changeColor('b',0)" />
<img alt="Green" width="20" height="20" src="green.png" onclick="changeColor('c',0)" />
<img alt="Brown" width="20" height="20" src="brown.png" onclick="changeColor('d',0)" />
<img alt="Blue" width="20" height="20" src="blue.png" onclick="changeColor('e',0)" />
<img alt="Magenta" width="20" height="20" src="magenta.png" onclick="changeColor('f',0)" />
<img alt="Cyan" width="20" height="20" src="cyan.png" onclick="changeColor('g',0)" />
<img alt="Gray" width="20" height="20" src="gray.png" onclick="changeColor('h',0)" />
<img alt="Default" width="20" height="20" src="default.png" onclick="changeColor('x',0)" />
</div>
</td>
<td>
<div class="graybox">
<input id="isForegroundBold" type="checkbox" onclick="if(this.checked){BoldText(0)}else{unBoldText(0)}" />Bold
</div>
</td>
</tr>
<tr>
<td>
<div class="graybox" style="text-align: right">
Background:
</div>
</td>
<td>
<div class="colorPicker">
<img alt="Black" width="20" height="20" src="black.png" onclick="changeColor('a',1)" />
<img alt="Red" width="20" height="20" src="red.png" onclick="changeColor('b',1)" />
<img alt="Green" width="20" height="20" src="green.png" onclick="changeColor('c',1)" />
<img alt="Brown" width="20" height="20" src="brown.png" onclick="changeColor('d',1)" />
<img alt="Blue" width="20" height="20" src="blue.png" onclick="changeColor('e',1)" />
<img alt="Magenta" width="20" height="20" src="magenta.png" onclick="changeColor('f',1)" />
<img alt="Cyan" width="20" height="20" src="cyan.png" onclick="changeColor('g',1)" />
<img alt="Gray" width="20" height="20" src="gray.png" onclick="changeColor('h',1)" />
<img alt="Default" width="20" height="20" src="default.png" onclick="changeColor('x',1)" />
</div>
</td>
<td>
<div class="graybox">
<input id="isBackgroundBold" type="checkbox" onclick="if(this.checked){BoldText(1)}else{unBoldText(1)}" />Bold
</div>
</td>
</tr>
<tr>
<td style="text-align: right; font-family: monospace">BSD LSCOLORS=</td>
<td>
<input style="font-family: monospace" id="colorStringBSD" type="text" value="exfxcxdxbxegedabagacad" maxlength="22" size="23" onchange="makePreview('BSD')"/>
</td>
<td>
<input type="button" value="preview" onclick="makePreview('BSD')" />
</td>
</tr>
<tr>
<td style="text-align: right; font-family: monospace">Linux LS_COLORS=</td>
<td>
<input style="font-family: monospace" id="colorStringLinux" type="text" value="" size="35" onchange="makePreview('Linux')"/>
</td>
<td>
</td>
</tr>
</table>
<br />
<div class="fixed">
blah:~/color_test root# ls -l
total 8
drwxr-xr-x 2 root root 68 Jul 31 15:52 <span id="directory" class="ls">1-directory</span>
lrwxr-xr-x 1 root root 9 Jul 31 15:52 <span id="system_link" class="ls">2-system_link -> /dev/null</span>
srw-r--r-- 1 root root 0 Jul 31 15:53 <span id="socket" class="ls">3-socket</span>
prw-r--r-- 1 root root 0 Jul 31 15:53 <span id="pipe" class="ls">4-pipe</span>
-rwxrwxrwx 1 root root 0 Jul 31 15:52 <span id="executable" class="ls">5-executable</span>
brw-r--r-- 1 root root 14, 0 Jul 31 15:52 <span id="block_special" class="ls">6-block_special</span>
crw-r--r-- 1 root root 3, 2 Jul 31 15:52 <span id="char_special" class="ls">7-char_special</span>
-rwsrwxrwx 1 root root 0 Jul 31 15:52 <span id="exe_setuid" class="ls">8-exe_setuid</span>
-rwxrwsrwx 1 root root 0 Jul 31 15:52 <span id="exe_setgid" class="ls">9-exe_setgid</span>
drwxrwxrwt 2 root root 68 Jul 31 15:52 <span id="dir_writeothers_sticky" class="ls">a-dir_writeothers_sticky</span>
drwxrwxrwx 2 root root 68 Jul 31 15:52 <span id="dir_writeothers_nosticky" class="ls">b-dir_writeothers_NOsticky</span>
blah:~/color_test root# <span id="cursor"> </span>
</div>
<p>
<!--
<div id="beast-mode" onclick="invert_colors()">
<span>Invert colors.</span>
</div>
-->
<a href="https://github.com/ggreer/lscolors">
<img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub" /></a>
</p>
</div>
</body>
</html>