如何找到两种颜色之间的所有颜色?
我需要选择两种颜色,然后在它们之间找到 X 种颜色(或色调),每种颜色之间的“距离”相同。
我还是不明白颜色是如何形成的。我应该尝试使用 HSV、RGB 还是十六进制?
I need to pick two colors, then find X colors (or tones) between them, each one separated with the same 'distance' of the other.
I still don't understand how colors are formed. Should I try using HSV, RGB, or hex?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
除非您真的知道您需要什么种类颜色,否则几乎不可能获得两种颜色之间的所有颜色。
只需查看颜色的表示即可 - 轮子的颜色如下所示:
您可以选择颜色在一条直线上,顺时针或逆时针走,你会得到不同的结果。
对于 RGB 颜色,其数量是有限的,等于 16 777 216 (245^3)。但您真的想选择所有这些颜色吗?选择一种方法来区分其他两种颜色“之间”的颜色,然后应用它并找到这些中间颜色。没有“单一且唯一”的最佳方法来在两种不同颜色之间挑选颜色。
编辑:
或者,您可以使用色差概念并选择与两种基色更接近的所有颜色,而不是这些基色彼此接近的颜色。但我会把所有的计算留给你。
Unless you really know what kind of colors do you need, this is almost impossible to get all the colors between two colors.
Just look at the representations of the colors - there are wheels with colors like that:
and you can pick colors on some straight line, going clockwise or counter-clockwise and you will get different results.
In case of RGB colors, their number is limites and is equal to 16 777 216 (245^3). But do you really want to pick all of these colors? Choose a method to distinguish colors "between" two other colors and then just apply it and find these intermediate colors. There is no "single and only" best method to pick colors 'between' two different colors.
EDIT:
Alternatively, you can just make use of Color Difference concept and pick all the colors that are closer to both base colors than these base colors are close to each other. But I will leave you all the calculations.
最简单的做法是获取第一个和第二个颜色的 RGB 值并将它们插值在一起,即。
编辑:您还可以使用 HSV 值代替 RGB 值
The simplest thing to do is to take the RGB values of the first and the second color and interpolate them together ie.
EDIT: You can also use the HSV value instead of the RGB value
我认为最好的选择是使用 HSL 表示形式。然后您可以使用色调值进行插值。与使用 RGB 插值相比,您将获得更好的结果。
I think your best option is to use a HSL representation. Then you can interpolate using the hue value. You will get better results than using a RGB interpolation.
颜色由位表示,就像计算机中的其他任何东西一样。
#FFFFFF
代表白色,#000000
代表黑色。这是 RGB 表示法,采用十六进制。要获取每个值的数值,请将其转换为无符号整数。然后你就有了需要划分的范围。Colors are represented by bits, just like anything else in computers.
#FFFFFF
represents white and#000000
represents black. This is the RGB notation, which is in hex. To get the numeric value for each, convert it to an unsigned integer. Then you have your range that you need to divide up.一般来说,两种颜色之间的颜色是给定颜色空间中连接颜色的线上的颜色。因此,RGB 颜色空间中的颜色与其他颜色空间中的颜色不同。
Generally, colors between two colors is the colors that are on the line connecting the colors in given color space. So, in RGB color space the colors are different then in other color spaces.