mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-25 09:16:15 -04:00
fix: color picker now updates fields
Signed-off-by: Corentin Thomasset <corentin.thomasset74@gmail.com>
This commit is contained in:
parent
48376c17b2
commit
efe62bb3cf
2 changed files with 10 additions and 1 deletions
|
@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- [feat] 404 route + page
|
- [feat] 404 route + page
|
||||||
- [feat] changelog in the About page
|
- [feat] changelog in the About page
|
||||||
- [feat] contributors list in the About page
|
- [feat] contributors list in the About page
|
||||||
|
- [fix] [ColorConverter] color picker now updates fields
|
||||||
|
|
||||||
## 1.0.1
|
## 1.0.1
|
||||||
- [chore] added changelog
|
- [chore] added changelog
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
hide-inputs
|
hide-inputs
|
||||||
mode="rgba"
|
mode="rgba"
|
||||||
v-model="rgbPicker"
|
v-model="rgbPicker"
|
||||||
|
@input="(v) => updateColors(v, 'picker')"
|
||||||
/>
|
/>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col cols="12" sm="6" align="center">
|
<v-col cols="12" sm="6" align="center">
|
||||||
|
@ -116,7 +117,7 @@
|
||||||
this.keyword = convert.rgb.keyword(r, g, b);
|
this.keyword = convert.rgb.keyword(r, g, b);
|
||||||
},
|
},
|
||||||
updateColors(value, fromType) {
|
updateColors(value, fromType) {
|
||||||
if (this.$refs[fromType].validate()) {
|
if (fromType === 'picker' || this.$refs[fromType].validate()) {
|
||||||
if (fromType === 'rgb') {
|
if (fromType === 'rgb') {
|
||||||
const [r, g, b] = value.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/).slice(1).map(v => parseInt(v));
|
const [r, g, b] = value.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/).slice(1).map(v => parseInt(v));
|
||||||
this.rgbPicker = {r, g, b}
|
this.rgbPicker = {r, g, b}
|
||||||
|
@ -150,6 +151,13 @@
|
||||||
} catch (ignored) {
|
} catch (ignored) {
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
|
} else if (fromType === 'picker') {
|
||||||
|
const {r, g, b} = value;
|
||||||
|
|
||||||
|
this.setRGB(r, g, b);
|
||||||
|
this.setHEX(r, g, b);
|
||||||
|
this.setHSL(r, g, b);
|
||||||
|
this.setKeyword(r, g, b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue