From 9ab4955166b7b1370fc2a49b152353241ca9e64a Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期一, 16 十月 2023 09:22:23 +0800
Subject: [PATCH] 小程序

---
 minipro_standard/uni_modules/uview-ui/libs/function/colorGradient.js |  134 --------------------------------------------
 1 files changed, 0 insertions(+), 134 deletions(-)

diff --git a/minipro_standard/uni_modules/uview-ui/libs/function/colorGradient.js b/minipro_standard/uni_modules/uview-ui/libs/function/colorGradient.js
index 9114884..e69de29 100644
--- a/minipro_standard/uni_modules/uview-ui/libs/function/colorGradient.js
+++ b/minipro_standard/uni_modules/uview-ui/libs/function/colorGradient.js
@@ -1,134 +0,0 @@
-/**
- * 姹備袱涓鑹蹭箣闂寸殑娓愬彉鍊�
- * @param {string} startColor 寮�濮嬬殑棰滆壊
- * @param {string} endColor 缁撴潫鐨勯鑹�
- * @param {number} step 棰滆壊绛夊垎鐨勪唤棰�
- * */
-function colorGradient(startColor = 'rgb(0, 0, 0)', endColor = 'rgb(255, 255, 255)', step = 10) {
-    const startRGB = hexToRgb(startColor, false) // 杞崲涓簉gb鏁扮粍妯″紡
-    const startR = startRGB[0]
-    const startG = startRGB[1]
-    const startB = startRGB[2]
-
-    const endRGB = hexToRgb(endColor, false)
-    const endR = endRGB[0]
-    const endG = endRGB[1]
-    const endB = endRGB[2]
-
-    const sR = (endR - startR) / step // 鎬诲樊鍊�
-    const sG = (endG - startG) / step
-    const sB = (endB - startB) / step
-    const colorArr = []
-    for (let i = 0; i < step; i++) {
-        // 璁$畻姣忎竴姝ョ殑hex鍊�
-        let hex = rgbToHex(`rgb(${Math.round((sR * i + startR))},${Math.round((sG * i + startG))},${Math.round((sB
-			* i + startB))})`)
-        // 纭繚绗竴涓鑹插�间负startColor鐨勫��
-        if (i === 0) hex = rgbToHex(startColor)
-        // 纭繚鏈�鍚庝竴涓鑹插�间负endColor鐨勫��
-        if (i === step - 1) hex = rgbToHex(endColor)
-        colorArr.push(hex)
-    }
-    return colorArr
-}
-
-// 灏唄ex琛ㄧず鏂瑰紡杞崲涓簉gb琛ㄧず鏂瑰紡(杩欓噷杩斿洖rgb鏁扮粍妯″紡)
-function hexToRgb(sColor, str = true) {
-    const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
-    sColor = String(sColor).toLowerCase()
-    if (sColor && reg.test(sColor)) {
-        if (sColor.length === 4) {
-            let sColorNew = '#'
-            for (let i = 1; i < 4; i += 1) {
-                sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1))
-            }
-            sColor = sColorNew
-        }
-        // 澶勭悊鍏綅鐨勯鑹插��
-        const sColorChange = []
-        for (let i = 1; i < 7; i += 2) {
-            sColorChange.push(parseInt(`0x${sColor.slice(i, i + 2)}`))
-        }
-        if (!str) {
-            return sColorChange
-        }
-        return `rgb(${sColorChange[0]},${sColorChange[1]},${sColorChange[2]})`
-    } if (/^(rgb|RGB)/.test(sColor)) {
-        const arr = sColor.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',')
-        return arr.map((val) => Number(val))
-    }
-    return sColor
-}
-
-// 灏唕gb琛ㄧず鏂瑰紡杞崲涓篽ex琛ㄧず鏂瑰紡
-function rgbToHex(rgb) {
-    const _this = rgb
-    const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
-    if (/^(rgb|RGB)/.test(_this)) {
-        const aColor = _this.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',')
-        let strHex = '#'
-        for (let i = 0; i < aColor.length; i++) {
-            let hex = Number(aColor[i]).toString(16)
-            hex = String(hex).length == 1 ? `${0}${hex}` : hex // 淇濊瘉姣忎釜rgb鐨勫�间负2浣�
-            if (hex === '0') {
-                hex += hex
-            }
-            strHex += hex
-        }
-        if (strHex.length !== 7) {
-            strHex = _this
-        }
-        return strHex
-    } if (reg.test(_this)) {
-        const aNum = _this.replace(/#/, '').split('')
-        if (aNum.length === 6) {
-            return _this
-        } if (aNum.length === 3) {
-            let numHex = '#'
-            for (let i = 0; i < aNum.length; i += 1) {
-                numHex += (aNum[i] + aNum[i])
-            }
-            return numHex
-        }
-    } else {
-        return _this
-    }
-}
-
-/**
-* JS棰滆壊鍗佸叚杩涘埗杞崲涓簉gb鎴杛gba,杩斿洖鐨勬牸寮忎负 rgba锛�255锛�255锛�255锛�0.5锛夊瓧绗︿覆
-* sHex涓轰紶鍏ョ殑鍗佸叚杩涘埗鐨勮壊鍊�
-* alpha涓簉gba鐨勯�忔槑搴�
-*/
-function colorToRgba(color, alpha) {
-    color = rgbToHex(color)
-    // 鍗佸叚杩涘埗棰滆壊鍊肩殑姝e垯琛ㄨ揪寮�
-    const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
-    /* 16杩涘埗棰滆壊杞负RGB鏍煎紡 */
-    let sColor = String(color).toLowerCase()
-    if (sColor && reg.test(sColor)) {
-        if (sColor.length === 4) {
-            let sColorNew = '#'
-            for (let i = 1; i < 4; i += 1) {
-                sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1))
-            }
-            sColor = sColorNew
-        }
-        // 澶勭悊鍏綅鐨勯鑹插��
-        const sColorChange = []
-        for (let i = 1; i < 7; i += 2) {
-            sColorChange.push(parseInt(`0x${sColor.slice(i, i + 2)}`))
-        }
-        // return sColorChange.join(',')
-        return `rgba(${sColorChange.join(',')},${alpha})`
-    }
-
-    return sColor
-}
-
-export default {
-    colorGradient,
-    hexToRgb,
-    rgbToHex,
-    colorToRgba
-}

--
Gitblit v1.9.3