Skip to content

Commit

Permalink
form
Browse files Browse the repository at this point in the history
  • Loading branch information
CarelessCourage committed Feb 4, 2024
1 parent 20a3e7b commit b19561c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/dye/composables/utils.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
export function rgbToHex(orig: any) {
var rgb = orig.replace(/\s/g, '').match(/^rgba?\((\d+),(\d+),(\d+),?([^,\s)]+)?/i),
hex = rgb ?
(rgb[1] | 1 << 8).toString(16).slice(1) +
(rgb[2] | 1 << 8).toString(16).slice(1) +
(rgb[3] | 1 << 8).toString(16).slice(1) : orig;
return "#" + hex;
hex = rgb
? (rgb[1] | (1 << 8)).toString(16).slice(1) +
(rgb[2] | (1 << 8)).toString(16).slice(1) +
(rgb[3] | (1 << 8)).toString(16).slice(1)
: orig
return '#' + hex
}

export function clamp(num: number, min: number, max: number) {
return num <= min ? min : num >= max ? max : num;
}
return num <= min ? min : num >= max ? max : num
}

0 comments on commit b19561c

Please sign in to comment.