colorUtils


public class ColorCalculator {
    //需要计算的原始颜色
    private static String originalColor = "#23a8d2";
    //需要计算颜色对于的透明度
    private static float percentTransparent = 0.5f;
    //透明层对应的底色
    private static String bgColor = "#000000";


    public static void main(String[] args) {


        if (originalColor.startsWith("#")) {
            originalColor = originalColor.replace("#", "");
        }
        if (bgColor.startsWith("#")) {
            bgColor = bgColor.replace("#", "");
        }
        int colorR = Integer.valueOf(originalColor.substring(0, 2), 16);
        int colorG = Integer.valueOf(originalColor.substring(2, 4), 16);
        int colorB = Integer.valueOf(originalColor.substring(4), 16);


        int bgColorR = Integer.valueOf(bgColor.substring(0, 2), 16);
        int bgColorG = Integer.valueOf(bgColor.substring(2, 4), 16);
        int bgColorB = Integer.valueOf(bgColor.substring(4), 16);


        int resultColorR = (int) (colorR * percentTransparent + (1 - percentTransparent) * bgColorR);
        int resultColorG = (int) (colorG * percentTransparent + (1 - percentTransparent) * bgColorG);
        int resultColorB = (int) (colorB * percentTransparent + (1 - percentTransparent) * bgColorB);


        String result = "#" + Integer.toHexString(resultColorR) + Integer.toHexString(resultColorG) + Integer.toHexString(resultColorB);
        System.out.printf("最后的结果是:%s", result);
    }
}
from sys import version from utils.ColorUtils import * if float(version[0:3]) < 3.6: print(color.FAIL+'Python 3.6 or above required!'+color.ENDC) exit() import platform from os import mkdir, makedirs, remove, path, system, environ, getcwd if 'Windows' in platform.system(): from os import startfile system('python3 -m pip install matplotlib scikit-learn') system('python3 -m pip install -r requirements.txt') system('python3 -m pip install torch==1.7.1+cpu torchvision==0.8.2+cpu -f https://download.pytorch.org/whl/torch_stable.html') import wget from zipfile import ZipFile from shutil import copy import sys import os import subprocess from getpass import getpass # Install Ansible password = getpass(color.BOLD+'Please enter linux password:'+color.ENDC) def run_cmd_pwd(cmd, password): os.system("bash -c \"echo "+password+" | sudo -S "+cmd+" &> /dev/null\"") def run_cmd(cmd): system("bash -c \""+cmd+"\"") # Install WSL if Windows if 'Windows' in platform.system(): trial = subprocess.run("where bash.exe", shell=True, stderr=subprocess.PIPE) stdout = trial.stderr.decode() if 'Could not find' in stdout: system("powershell.exe -ExecutionPolicy Bypass 'framework/install_scripts/install_wsl.ps1'") # Installing InfluxDB if 'Windows' in platform.system(): install_dir = 'InfluxDB' influxdb_install_path = 'C:/Program Files/' + install_dir if not path.exists(influxdb_install_path+'/influxdb-1.8.3-1/influxd.exe'): print(color.HEADER+'Installing InfluxDB'+color.ENDC) url = 'https://dl.influxdata.com/influxdb/releases/influxdb-1.8.3_windows_amd64.zip' mkdir(influxdb_install_path) filename = wget.download(url) zf = ZipFile(filename, 'r') zf.extractall(influxdb_install_path) zf.close() for folder in ['meta', 'data', 'wal']: mkdir(influxdb_install_path+'/'+folder) copyfile('framework/install_scripts/influxdb.conf', influxdb_install_path+'/influxdb-1.8.3-1/influxdb.conf') remove(filename) print('InfluxDB service runs as a separate front-end window. Please minimize this window.') startfile(influxdb_install_path+'/influxdb-1.8.3-1/influxd.exe') elif 'Linux' in platform.system(): run_cmd_pwd('apt install influxdb', password)
03-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值