import Taro from "@tarojs/taro";

export function alphaToHex(alpha) {
    var alphaValue = Math.round(alpha * 255); // 将透明度乘以255并四舍五入
    var hexValue = alphaValue.toString(16); // 将整数转换为十六进制字符串
    if (hexValue.length === 1) {
        hexValue = "0" + hexValue; // 如果十六进制字符串只有一位，补零
    }
    return hexValue;
}

export function rpxToPx(n: number) {
    var rate = Taro.getSystemInfoSync().windowWidth / 750;
    return n * rate;
}