Skip to content

Commit

Permalink
Separated the embedded example
Browse files Browse the repository at this point in the history
  • Loading branch information
John Chen committed Nov 27, 2024
1 parent bc3ad23 commit 5b20705
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
32 changes: 32 additions & 0 deletions examples/embedded.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="../dist/color-picker.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body style="margin: 0;">
<div class="cp-container cp-embedded"></div>
<script src="../dist/ColorPicker.standalone.js"></script>
<script>
const savedColors = [
[228, 202, 152, 255],
[228, 110, 72, 255],
[157, 110, 72, 255]
];
let parent = document.querySelector('.cp-container');
const colorPickerConfig = {
parent: parent,
initColor: [165, 234, 251, 255],
initColorType: "rgb",
onColorSelect: (selectedColor) => {
console.log("Color selected:", selectedColor);
},
savedColors: savedColors,
mode: 'NETLOGO'
};
const colorPicker = new ColorPicker.ColorPicker(colorPickerConfig);
</script>
</body>
</html>
4 changes: 2 additions & 2 deletions examples/standalone.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body style="margin: 0;">
<div class="cp-container cp-embedded"></div>
<body>
<div class="cp-container"></div>
<script src="../dist/ColorPicker.standalone.js"></script>
<script>
const savedColors = [
Expand Down

0 comments on commit 5b20705

Please sign in to comment.