-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
81 lines (78 loc) · 3.52 KB
/
index.html
File metadata and controls
81 lines (78 loc) · 3.52 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="Convert text to Gradient">
<meta name="author" content="Christian Fredrik Linchausen">
<title>Text to Gradient</title>
<!-- Bootstrap core CSS -->
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<!-- Custom styles for this template -->
<link href="css/cover.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="cover-heading">Text to Gradient</h1>
<input spellcheck="false" placeholder="Text" type="text" class="form-control"></input>
<div class="row">
<div class="col-md-3">
<div class="well one">#333333</div>
</div>
<div class="col-md-3">
<div class="well two">#333333</div>
</div>
<div class="col-md-3">
<div class="well three">rgba(51,51,51,1)</div>
</div>
<div class="col-md-3">
<div class="well four">rgba(51,51,51,1)</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12 gradient">
</div>
</div>
<div class="row">
<div class="col-md-12">
<p>
Christian Fredrik Linchausen
</p>
<p>
Inspired on this site <a href="http://randomstringtocsscolor.com" target="_blank">randomstringtocsscolor.com</a>
</p>
<p>
I decided to use a different way to calculate the colors. I use CRC-32 (<a href="https://en.wikipedia.org/wiki/Cyclic_redundancy_check" target="_blank">Cyclic Redundancy Check</a>) to convert the text into 32 bits. Using this <a href="http://www.simplycalc.com/crc32-source.php" target="_blank">http://www.simplycalc.com/crc32-source.php</a> as the algorithm. Two different colors are created by the text, then a linear gradient is created with those colors.
</p>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h2>How does it work?</h2>
<ul class="list-unstyled">
<li>Take the text and run it through the CRC algorithm</li>
<li>Split result into 4 numbers (1 byte each)</li>
<li>The first 3 bytes are used as the RGB colors. Each byte ranges from 0 - 255. The last byte is used to calculate a percentage of 255. This percentage is the alpha in the color. </li>
</ul>
</div>
</div>
</div>
<script src="js/main.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</body>
</html>