如何调整的颜色code色调? [英] How to adjust the hue of a color code?

查看:167
本文介绍了如何调整的颜色code色调?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许有人知道在Java中(安卓)的方式来应用色调颜色code?

Maybe someone know of a way in Java (Android) to apply HUE to a color code?

例如,如果我有#1589FF和应用180 HUE,我应该得到#FF8B14。

For example if I have #1589FF and apply 180 HUE, I should get #FF8B14.

推荐答案

这应该做的伎俩:

Color c = new Color(0x15, 0x89, 0xFF);

// Get saturation and brightness.
float[] hsbVals = new float[3];
Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), hsbVals);

// Pass .5 (= 180 degrees) as HUE
c = new Color(Color.HSBtoRGB(0.5f, hsbVals[1], hsbVals[2]));

这篇关于如何调整的颜色code色调?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆