-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathui.html
85 lines (76 loc) · 1.74 KB
/
ui.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
<!--Header-->
<h1> Change Widgets Color </h1>
<!-- Short app explanation -->
<p>
Will change the color of all objects with the key word in their title
</p>
<!--Asks user for a hex color value-->
<label for = 'hex-input'>
New Hex Color
<input
required
id = "hex-input"
type = "text"
max = "6"
min = "6"
placeholder = "fafa1d"
/>
</label>
<!--Asks user for a key word-->
<label for = 'keyword-input'>
Key Word
<input
required
id = "keyword-input"
type = "text"
placeholder = "title"
/>
</label>
<!--Submit button-->
<button id = "button">
Change Color
</button>
<style>
body{
font-family: sans-serif;
}
p{
color: #777777;
}
label{
margin-top: 20px;
display: flex;
flex-direction: column;
margin-bottom:10px;
width: 75%;
font-weight: 600;
}
input{
font-size: 14px;
margin-top: 3px;
border-style: none;
border-bottom-style: solid;
outline: none;
font-weight: 600;
}
button{
margin-top: 20px;
padding: 10px;
font-weight: 700;
}
</style>
<script>
//Creates variables that allow us to access the HTML components
const hexInput = document.getElementById('hex-input');
const keywordInput = document.getElementById('keyword-input');
const button = document.getElementById('button');
//Takes input values and shares them with your Figma code
function whenButtonIsClicked(){
const hex = hexInput.value;
const keyword = keywordInput.value;
//Sends your values to your Figma code. * is the code's worker address
parent.postMessage({ pluginMessage: { hex, keyword } }, '*')
}
//creates a listener that will activate whenever the button is clicked
button.addEventListener('click', whenButtonIsClicked)
</script>