如何在javascript中生成颜色序列? [英] How to generate a Color Sequence in javascript?

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

问题描述

我必须显示一个数字,当数字的值减小时,颜色的颜色从红色变为绿色。

I have to display a number whose color changes from Red to Green uniformly as the value of the number decreases.

有没有办法生成字体颜色那个数字根据值?

Is there any way to generate the font color of that number according to the value ?

推荐答案

减少数字等于红色到绿色,我猜?

Decreasing number equals red to green, I'd guess?

为什么不简单一点,从你的全红#FF0000开始,然后在$ 00 $ 00下自己降价
到绿色?

Why not make it simple, start out with your all red #FF0000, and work yourself down to green at #00FF00?

两者之间有FF * FF(256 * 256 = 65536)步;根据您的需要调整它,获得颜色所需的JavaScript应该很简单。

Between the two there are FF*FF (256*256 = 65536) steps; adapt this to your needs and the JavaScript needed to get color should be simple.

ColorCalc - 玩/理解十六进制的好工具v颜色

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

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