-
Notifications
You must be signed in to change notification settings - Fork 2
/
WebView.html
106 lines (97 loc) · 2.9 KB
/
WebView.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My WebView</title>
<style>
body {
width: 100vw;
height: 100vh;
display: flex;
justify-content: center;
}
form {
width: 70%;
height: 200px;
border: 2px solid;
border-radius: 10px;
padding: 10px;
margin: 20px;
text-align: center;
}
#btn_box {
border: none;
padding: 0;
margin: 0;
margin-top: 10px;
width: auto;
height: auto;
}
button {
width: 120px;
border-radius: 6px;
border: 1px solid;
padding: 5px;
font-weight: 600;
letter-spacing: 1px;
}
input[type='color'] {
width: 100px;
height: 20px;
border: none;
padding: 0;
margin: 0;
}
label {
font-size: 1rem;
font-weight: 600;
display: block;
}
</style>
</head>
<body>
<form>
<label for="text_color">Text Color</label>
<input id="text_color" name="text_color" type="color" />
<br />
<label for="bg_color">Background Color</label>
<input id="bg_color" name="bg_color" type="color" />
<br />
<label for="bionic_range">Range of Word to Highlight</label>
<input id="bionic_range" type="range" value="50" min="1" max="100" />
<br />
<label for="opacity_s">Opacity of Second Part</label>
<input id="opacity_s" name="opacity_s" type="range" min="0" max="1" step="0.1" value="0.5" />
<div id="btn_box">
<button type="button" onclick="ApplyChange()">Apply</button>
<button type="button" onclick="re()">Reset</button>
</div>
</form>
<script>
const vscode = acquireVsCodeApi()
function ApplyChange() {
const text_color = document.getElementById('text_color').value
const bg_color = document.getElementById('bg_color').value
const bionic_range = document.getElementById('bionic_range').value
const opacity_s = document.getElementById('opacity_s').value
vscode.postMessage({
command: 'applyStyles',
textColor: text_color,
bgColor: bg_color,
opacity: opacity_s,
bionicRange: bionic_range,
})
}
function re() {
vscode.postMessage({
command: 'applyStyles',
textColor: false,
bgColor: false,
opacity: "0.5",
bionicRange: 50
});
}
</script>
</body>
</html>