From 00bfd31c3080bb8fed97a30714a9a5d392cafbaf Mon Sep 17 00:00:00 2001 From: Akash187 Date: Fri, 5 Nov 2021 16:38:54 +0530 Subject: [PATCH 1/9] feat: added option to pass custom width to color picker --- src/color/ColorPicker.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/color/ColorPicker.vue b/src/color/ColorPicker.vue index c9a1c0a..83d378d 100644 --- a/src/color/ColorPicker.vue +++ b/src/color/ColorPicker.vue @@ -124,11 +124,14 @@ export default defineComponent({ type: String, default: 'vue-colorpicker-history', }, + width: { + type: Number, + default: 200, + }, }, data() { return { hueWidth: 15, - hueHeight: 152, previewHeight: 30, modelRgba: '', modelHex: '', @@ -145,6 +148,9 @@ export default defineComponent({ isLightTheme(): boolean { return this.theme === 'light' }, + hueHeight(): number { + return this.width * 0.8 + }, totalWidth(): number { return this.hueHeight + (this.hueWidth + 8) * 2 }, From a70b80dbdd35ce2d525e92902c5ac964e2024568 Mon Sep 17 00:00:00 2001 From: Akash187 Date: Fri, 5 Nov 2021 17:06:32 +0530 Subject: [PATCH 2/9] feat: added option to pass width of color picker and some style fixes. --- src/color/ColorPicker.vue | 6 ++++-- src/color/Colors.vue | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/color/ColorPicker.vue b/src/color/ColorPicker.vue index 83d378d..c25db3e 100644 --- a/src/color/ColorPicker.vue +++ b/src/color/ColorPicker.vue @@ -126,7 +126,7 @@ export default defineComponent({ }, width: { type: Number, - default: 200, + default: 198, }, }, data() { @@ -149,7 +149,9 @@ export default defineComponent({ return this.theme === 'light' }, hueHeight(): number { - return this.width * 0.8 + //making hueHeight such that overall width equal to passed width + //20 is the sum of left and right padding of Color Picker + return this.width - ((this.hueWidth + 8) * 2 + 20) }, totalWidth(): number { return this.hueHeight + (this.hueWidth + 8) * 2 diff --git a/src/color/Colors.vue b/src/color/Colors.vue index 3b051c9..6f1d85d 100644 --- a/src/color/Colors.vue +++ b/src/color/Colors.vue @@ -96,7 +96,10 @@ export default defineComponent({