-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.html
44 lines (39 loc) · 1.09 KB
/
example.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Usage</title>
<style>
html,
body {
width: 100vw;
height: 100vh;
margin: 0;
display: grid;
place-items: center;
}
div {
height: min(70vh, 70vw);
width: min(90vh, 90vh);
}
img {
width: 100%;
height: 100%;
object-fit: cover;
}
</style>
</head>
<body>
<div>
<img src="https://cdn.jsdelivr.net/gh/NacreousDawn596/dynamic-background@master/rose-pine-bg%402x.png" />
</div>
<script type="module">
import { getGradientFromElement } from "https://cdn.jsdelivr.net/gh/NacreousDawn596/dynamic-background@master/main.js";
const element = document.getElementsByTagName("img")[0];
const gradient = await getGradientFromElement(element);
console.log(gradient);
document.body.style.background = gradient;
</script>
</body>
</html>