-
Notifications
You must be signed in to change notification settings - Fork 0
/
colors.html
145 lines (138 loc) · 3.46 KB
/
colors.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
<html>
<head>
<!-- jQuery -->
<script src="js.js"></script>
<!-- Bootstrap 3 -->
<link rel="stylesheet" href="bootstrap.css">
<!-- MiniColors -->
<script src="jquery.minicolors.js"></script>
<link rel="stylesheet" href="jquery.minicolors.css">
<style>
body { background-color:transparent;}
dl {
margin: 20px 0;
}
dt {
font-size: 120%;
}
dd {
padding: 10px 20px 20px 20px;
}
dd:last-child {
border-bottom: none;
}
code {
color: black;
border: none;
background: rgba(128, 128, 128, .1);
}
pre {
background: #f8f8f8;
border: none;
color: #333;
padding: 20px;
}
h2 {
margin-top: 50px;
}
h3 {
color: #aaa;
}
.jumbotron {
padding: 40px;
}
.jumbotron h1 {
margin-top: 0;
}
.jumbotron p:last-child {
margin-bottom: 0;
}
</style>
<script>
$(document).ready( function() {
$('.demo').each( function() {
//
// Dear reader, it's actually very easy to initialize MiniColors. For example:
//
// $(selector).minicolors();
//
// The way I've done it below is just for the demo, so don't get confused
// by it. Also, data- attributes aren't supported at this time...they're
// only used for this demo.
//
$(this).minicolors({
control: $(this).attr('data-control') || 'hue',
defaultValue: $(this).attr('data-defaultValue') || '',
format: $(this).attr('data-format') || 'hex',
keywords: $(this).attr('data-keywords') || '',
inline: $(this).attr('data-inline') === 'true',
letterCase: $(this).attr('data-letterCase') || 'lowercase',
opacity: $(this).attr('data-opacity'),
position: $(this).attr('data-position') || 'bottom left',
swatches: $(this).attr('data-swatches') ? $(this).attr('data-swatches').split('|') : [],
change: function(value, opacity) {
if( !value ) return;
if( opacity ) value += ', ' + opacity;
if( typeof console === 'object' ) {
console.log(value);
}
},
theme: 'bootstrap'
});
});
});
</script>
</head>
</head>
<script>
var lastc = [];
setInterval(function()
{
var str = document.getElementById("rgba").value;
var str = str.replace("rgba", "");
var str = str.replace("(", "");
var nr = str.indexOf(",");
var c1 = "";
for(var i = 0; i <= nr; i++)
{
if(i < nr) c1 = "" + c1+str[i];
}
var str = str.replace(c1 + ",", "");
var nr = str.indexOf(",");
var c2 = "";
for(var i = 0; i <= nr; i++)
{
if(i < nr) c2 = "" + c2+str[i];
str[i] = "";
}
var str = str.replace(c2 + ",", "");
var nr = str.indexOf(",");
var c3 = "";
for(var i = 0; i <= nr; i++)
{
if(i < nr) c3 = "" + c3+str[i];
str[i] = "";
}
var str = str.replace(c3 + ",", "");
var nr = str.indexOf(")");
var c4 = "";
for(var i = 0; i <= nr; i++)
{
if(i < nr) c4 = "" + c4+str[i];
str[i] = "";
}
var str = str.replace(c4 + ")", "");
c4 = c4 * 255;
//if(lastc[0] == c1 && lastc[1] == c2 && lastc[2] == c3 && lastc[3] == c4) return;
resourceCall("ChangeColor", c1,c2,c3,c4);
lastc[0] = c1;
lastc[1] = c2;
lastc[2] = c3;
lastc[3] = c4;
},500);
</script>
<span style="position: absolute; top:65%;">
<input type="text" id="rgba" class="form-control demo" data-format="rgb" data-opacity="255" value="rgba(255, 255, 255, 1)">
</span>
</body>
</html>