@@ -78,9 +80,9 @@
|
-
{{ color.hex }} |
-
{{ color.rgb }} |
-
{{ color.hsl }} |
+
{{ color.hex }} |
+
{{ color.rgb }} |
+
{{ color.hsl }} |
diff --git a/js/app.js b/js/app.js
index 8f92059..7ab3e44 100644
--- a/js/app.js
+++ b/js/app.js
@@ -1,3 +1,5 @@
+const clipboard = navigator.clipboard;
+
let app = new Vue({
el: '#app',
@@ -10,6 +12,8 @@ let app = new Vue({
],
inputBox: "ccc\n#4f46e5\n#db2777aa\n",
+ copyInput: "",
+
hexRegex: /^\#?[a-f0-9]{3,9}/i,
rgbRegex: /^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)/i,
rgbaRegex: /^rgba\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*(0(\.[0-9])?|1(\.0)?)\s*\)/i,
@@ -108,6 +112,7 @@ let app = new Vue({
blue = Number.parseInt(blue);
converted.hex = "#" + this.rgbaToHexa(red, green, blue, alpha);
+
converted.rgb = "rgba(" + red + ", " + green + ", " + blue + ", " + alpha + ")";
let hsl = this.rgbToHsl(red, green, blue);
@@ -367,6 +372,12 @@ console.error('hexa to HSLa not implemented yet');
}
return alpha.toFixed(1);
- }
+ },
+
+ updateClipboard: function (text) {
+ clipboard.writeText(text).then(() => {
+ console.log('text copied!');
+ });
+ },
},
});