-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
124 lines (124 loc) · 3.82 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
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
<!DOCTYPE html>
<html lang="ja">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>RGBシミュレーター</title>
<!-- ogp -->
<meta property="og:url" content="https://progedu.github.io/rgb-simulator" />
<meta property="og:title" content="RGBシミュレーター" />
<meta
property="og:description"
content="RGBの値を調節して色の変化を確認できます。"
/>
<meta property="og:site_name" content="progedu.github.io/rgb-simulator" />
<meta
property="og:image"
content="https://progedu.github.io/rgb-simulator/ogp.png"
/>
<meta property="og:type" content="website" />
<!-- ogp Twitter -->
<meta name="twitter:card" content="summary_large_image" />
<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1"
crossorigin="anonymous"
/>
<style>
.color-legend-wrapper {
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
padding: 20px;
}
.color-legend {
background: white;
padding: 10px;
font-weight: bold;
}
input[type="text"] {
width: 2.5em;
}
.color-slider-wrapper {
margin-bottom: 15px;
}
</style>
</head>
<body>
<div id="app" class="container mt-5">
<h2>RGBシミュレーター</h2>
<div class="color-slider-wrapper">
<label style="color: red"
>Red: <input type="text" v-model="colorValues.red" /></label
><input
class="form-range"
name="red"
id="red"
type="range"
min="0"
max="255"
v-model="colorValues.red"
/>
</div>
<div class="color-slider-wrapper">
<label style="color: green"
>Green: <input type="text" v-model="colorValues.green" /></label
><input
class="form-range"
name="green"
id="green"
type="range"
min="0"
max="255"
v-model="colorValues.green"
/>
</div>
<div class="color-slider-wrapper">
<label style="color: blue"
>Blue: <input type="text" v-model="colorValues.blue" /></label
><input
class="form-range"
name="blue"
id="blue"
type="range"
min="0"
max="255"
v-model="colorValues.blue"
/>
</div>
<div class="color-legend-wrapper" :style="generatedRGBStyle">
<span class="color-legend"
>色の見本:RGB({{colorValues.red}},
{{colorValues.green}},
{{colorValues.blue}})</span
>
<!-- <span>hex: #{{Number(colorValues.red).toString(16)}}{{Number(colorValues.green).toString(16)}}{{Number(colorValues.blue).toString(16)}}</span> -->
</div>
</div>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script>
Vue.createApp({
setup() {
const colorValues = Vue.ref({
red: 100,
green: 100,
blue: 100,
});
const generatedRGBStyle = Vue.computed(() => {
return `background: rgb(${colorValues.value.red}, ${colorValues.value.green}, ${colorValues.value.blue})`;
});
return {
colorValues,
generatedRGBStyle,
};
},
}).mount("#app");
</script>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW"
crossorigin="anonymous"
></script>
</body>
</html>