-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgallery.html
319 lines (313 loc) · 8.46 KB
/
gallery.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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
<!Doctype HTML>
<html lang="en">
<head>
<meta name="author" content="Brandon Diaz-Abreu">
<meta name="description" content="A tool for visual designers and web developers. Draw inspiration from these HEX colors that have some personality.">
<meta name="keywords" content="Fun HEX color names">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#408CFF">
<title>Cheeky Colors</title>
<style type="text/css">
@font-face {
font-family: 'Mouse Memoirs';
src: url('fonts/Mouse_Memoirs/mousememoirs-regular-webfont.woff2') format('woff2'),
url('fonts/Mouse_Memoirs/mousememoirs-regular-webfont.woff') format('woff');
font-weight: normal;
font-style: normal;
}
body{
background: #408CFF;
/* ^ For browsers that do not support gradients */
background: linear-gradient(135deg, #408CFF, #DA4BFF);
min-height: 100vh;
margin: 0;
text-align: center;
font-size: 15px;
}
h2, h3{
margin: 0;
}
button{
padding: 1vh 1vh;
background-color: transparent;
border: 2px solid #000000;
border-radius: 0.5em;
font-size: 1.1em;
}
button:hover{
background-color: white;
color: #000000;
cursor: pointer;
}
button a{
text-decoration: none;
color: initial;
}
#search_area, #search_toggle{
position: fixed;
top: 0;
min-height: 100vh;
z-index: 5;
transition: 0.3s ease;
}
#search_area{
background: #FFFFFF;
width: 25%;
text-align: initial;
padding: 1px 1%;
}
#search_toggle{
background: #EAEAEA;
left: 27%;
}
#search_toggle #trigger{
margin-top: 46vh;
transition: 0.3s ease;
}
input{
max-width: 70%;
}
#main_area{
width: 65%;
min-height: 100vh;
margin: 1vh 2vw 1vh 31%;
}
.legible_background{
background-color: #FFFFFF;
border-radius: 1em;
padding: 1px 10px;
}
.legible_background p{
text-align: initial;
}
#desktop_instructions,
#fork_banner,
.hexcode,
.color_title:hover .plaintext{
display: none;
}
.color_block{
min-width: 100px;
min-height: 120px;
width: 20%;
height: 20vw;
display: inline-block;
background-color: #FFFFFF;
border-radius: 12px;
margin: 12px;
box-shadow: 0px 0px 51px 0px rgba(0, 0, 0, 0.08),
0px 6px 18px 0px rgba(0, 0, 0, 0.05);
transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
transform: translateY(0px);
}
.color_display{
height: 48%;
border-radius: 12px 12px 0px 0px;
margin: 4% 5% -4% 5%;
}
.def_link{
color: #000000;
margin: 0.6vmin 0;
}
.def_link:hover{
opacity: 0.7;
color: blue;
}
.color_title{
background-color: #FFFFFF;
text-align: center;
}
.color_title p{
margin: 0.8vmin 0;
}
.color_title:hover .hexcode{
font-family: 'Mouse Memoirs', sans-serif;
display: block;
font-size: 1.3em;
}
.button_container{
margin: 4vh 0;
}
footer{
width: 100%;
background-color: #FFFFFF;
padding: 0.5vh 0;
}
@media only screen and (min-width: 800px){
body{
font-size: 21px;
}
h2, h3{
margin: 1vh 0;
}
#search_area{
width: 15%;
padding: 1px 1%;
}
input{
max-width: 90%;
}
#main_area{
width: 75%;
margin: 1vh 2vw 1vh 19%;
}
#mobile_instructions{
display: none;
}
#desktop_instructions{
display: initial;
}
#fork_banner{
display: inline;
position: absolute;
top: 0;
right: 0;
border: 0;
}
#search_toggle{
background: #EAEAEA;
left: 17%;
}
.color_display{
height: 65%;
}
.color_block{
margin: 20px;
}
.color_title p{
font-size: 25px;
}
.color_title:hover .hexcode{
font-size: 25px;
}
}
</style>
<script type="text/javascript" src="dictionary/dictionary.js"></script>
<script type="text/javascript" src="utils.js"></script>
</head>
<body>
<div id="search_area">
<h2><u>Filters</u></h2>
<h3>Search By Name</h3>
<input type="text" placeholder="badass">
<h3>Search By Color</h3>
<input type="color">
<div id="buttonRow">
<button>Green</button>
<button>Red</button>
<button>Blue</button>
</div>
<h3>Search By Length</h3>
<div id="buttonRow">
<button>3 Letters</button>
<button>6 Letters</button>
</div>
</div>
<div id="search_toggle">
<div id="trigger" onclick="toggleSidebar()">
<span>></span>
</div>
</div>
<div id="main_area">
<div class="legible_background">
<h1>Cheeky Colors</h1>
<p>A collection of over 14,000 words from various languages that can be spelled using the hexadecimal digits. See what colors they produce when used as a hex color code and check their definiton on Wiktionary.
<span id="desktop_instructions">Hover over a color name to view its hex code.</span>
<span id="mobile_instructions">Tap on the name of a color to view its hex code.</span>
</p>
</div>
<a href="https://github.com/brandon8000/Cheeky-Colors"><img id="fork_banner" src="images/fork_me.png" alt="Fork this project on GitHub"></a>
<div id="display_area"></div>
<div class="button_container">
<button id="loader">Load More</button>
<button id="redirect"><a href="#">View All</a></button>
</div>
<noscript>
<div class="color_block">
<div class="color_display" style="background-color: #BADA55;">
</div>
<div class="color_title">
<p class="plaintext">BADASS</p>
<p class="hexcode">#BADA55</p>
</div>
<a class="def_link" href="https://en.wiktionary.org/wiki/badass" target="_blank">Definition</a>
</div>
<div class="color_block">
<div class="color_display" style="background-color: #CA7;">
</div>
<div class="color_title">
<p class="plaintext">CAT</p>
<p class="hexcode">#CA7</p>
</div>
<a class="def_link" href="https://en.wiktionary.org/wiki/cat" target="_blank">Definition</a>
</div>
<div class="color_block">
<div class="color_display" style="background-color: #2EA;">
</div>
<div class="color_title">
<p class="plaintext">SEA</p>
<p class="hexcode">#5EA</p>
</div>
<a class="def_link" href="https://en.wiktionary.org/wiki/sea" target="_blank">Definition</a>
</div>
<div class="color_block">
<div class="color_display" style="background-color: #BAE;">
</div>
<div class="color_title">
<p class="plaintext">BAE</p>
<p class="hexcode">#BAE</p>
</div>
<a class="def_link" href="https://en.wiktionary.org/wiki/bae" target="_blank">Definition</a>
</div>
<div>Please enable JavaScript to view more!</div>
</noscript>
<footer>Designed with ❤︎ in New Jersey</footer>
<script type="text/javascript">
var referenceSet = new Array(cheekyDictionary.length);
referenceSet.fill(false);
/*console.log("Look at the reference set: "+referenceSet);*/
if(Object.seal){
Object.seal(referenceSet);
}
else{
console.log("The reference set is not fixed size!");
}
document.getElementById("loader").addEventListener("click", loadRandom);
loadRandom();
/*Algorithm to find similar colors
Parse the hex code and find the segment with the highest value. Match with colors that have a highest value segment within the range + or - 64 bytes of that segment value.
For example:
#37a10f
highest value segment is the middle "a1"
Accept all colors that have a middle segment value of "71" to "d1"
Note that the 3-character names expand to be 6 characters by inserting a copy of each character right after itself. So, #5EA expands to #55EEAA.
Some code:
document.getElementById('main_button').addEventListener("click",convertToHex);
let sourceText = document.getElementById('main_input');
function convertToHex(e){
/*
var hex = '';
for(var i=0;i<str.length;i++) {
hex += ''+str.charCodeAt(i).toString(16);
}
*\/
alert("That converts to this!");
}
*/
let triggerPosition = 0;
let sidebarActive = true;
let triggerIcon = document.querySelector("#trigger");
let sidebar = document.querySelector("#search_area");
function toggleSidebar(){
triggerIcon.style=`transform: rotate(${triggerPosition+=180}deg)`;
if(sidebarActive){
sidebar.style += "width: 0%; opacity:0";
}
else{
sidebar.style += "width: initial; opacity:1";
}
}
</script>
</div>
</body>
</html>