-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
52 lines (50 loc) · 3.06 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
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>RGB565 to RGB888 Conversion utility</title>
<meta name="description" content="Utility to convert RGB565 to RGB888 and vice-versa"/>
<meta name="keywords" content="RGB565 RGB888 color converter"/>
<meta name="robots" content="index,nofollow"/>
<meta http-equiv="content-language" content="en" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
label{display: block;font-size: 65%;font-weight: bold;}
h1{font-size: 120%}
input#colorInput{width: 3em;height: 1.5em;display: none}
div#colorOutput{width: 3em;height: 1.2em;border: 1px solid black;padding: 1px 2px;border-radius: 2px;display: inline-block;position: relative;top:0.5em;background-color: #60e8a0}
div.block{display: inline-block;}
div#main{display: none}
</style>
</head>
<body>
<h1>RGB565 to RGB888 Conversion</h1>
<div id="main">
<div class="block">
<label for="colorInput">RGB656</label>
<input type="text" id="in565" maxlength="6" minlength="4" size="8" placeholder="color input" value="0xABCD">
</div>
<div class="block">
<button>Convert</button>
</div>
<div class="block">
<label for="colorInput">RGB888</label>
<input type="color" id="colorInput" value="#60e8a0"/>
<div id="colorOutput"></div>
<input type="text" id="in888" maxlength="8" minlength="6" size="8" placeholder="color input" value="0x60e8a0">
</div>
</div>
<noscript>
Javascript is required for the conversion
</noscript>
<script>!function(a,b,c,d){"use strict";function i(a){return document.getElementById(a)}function j(){return i(a)}function k(){return i(d)}function l(){return i(b)}function m(){return i(c)}function n(a,b){for(;a.length<b;)a="0"+a;return a}function o(a,b){return n(a.toString(16).toUpperCase(),b)}function p(a,b){i(a).onchange=b}function q(){var a=parseInt(m().value,16);if(a>65535)return s();var b=Math.floor((a>>f&31)*e/31+.5),c=Math.floor((a>>g&63)*e/63+.5),d=Math.floor((31&a)*e/31+.5),i=o(b<<16|c<<8|d,0);l().value!=h+i&&(l().value=h+i,j().value="#"+i,k().style.backgroundColor="#"+i)}function r(){var a=h+j().value.substr(1).toUpperCase();l().value!=a&&(l().value=a,s())}function s(){var a=parseInt(l().value,16);if(a>16777215)return r();var b="#"+a.toString(16);j().value!=b&&(j().value=b,k().style.backgroundColor=b);var c=a>>16&e,d=a>>8&e,i=a&e,b=c>>3<<f|d>>2<<g|i>>3;b=h+o(b,4),m().value!=b&&(m().value=b)}var e=255,f=11,g=5,h="0x";s(),"text"!=j().type&&(j().style.display="inherit",k().style.display="none",p(a,r)),p(b,s),p(c,q),i("main").style.display="block"}("colorInput","in888","in565","colorOutput");</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-97024221-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>