创建线性调色板
我正在绘制 FFT 并且想要更好的颜色。我的值在 X 和 Y 之间,并希望在功率谱中表示它们(值越高=颜色越亮)。目前我只使用黑/白(RGB 为 0-255),但我希望它是多种颜色,并且(颜色)分辨率高于 255(65k?)。
我需要颜色在它们之间很好地褪色,所以如果 0 是黑色,100 是白色,我需要 50 是 50% 白色(灰色)。但我想要按顺序排列多种颜色,而不仅仅是 RGB 原色(红色、绿色或蓝色)。
最好我希望能够选择颜色的点(不均匀分布)。例如 [0]="#00000"、[99]="#44000"、[149]="#FF0000"、[199]="#FFFF00" 等。
现在我的问题是计算结果会是什么样子喜欢?我猜有一些我没有想到的简单/聪明的方法。
我隐约记得除了 RGB 之外还有其他一些颜色计算方法可以用于此?或者是在图片上使用某种画笔,然后对颜色值进行采样的最佳方法?
我正在使用 C# .Net,但我不需要完全工作的代码(我可以做到) - 所以任何示例/提示都会很好。
I am painting a FFT and want better colors. I have values between X and Y and want to represent them in a power spectrum (higher value=brighter color). Currently I'm just using black/white (0-255 on RGB), but I would like it to be multiple colors with higher (color) resolution than 255 (65k?).
I need the colors to fade nicely between them, so if 0 is black and 100 is white I need 50 to be 50% white (grey). But I want multiple colors in sequence and not just RGB primary colors (red, green or blue).
Preferrably I would like to be able to select at what point the colors are (not evenly spaced). So for example [0]="#00000", [99]="#44000", [149]="#FF0000", [199]="#FFFF00", etc.
Now my question is what would the calculations look like? I'm guessing there is some simple/smart way I'm not thinking of.
I vaguely remember something about some other color calculation method than RGB that will work for this? Or is the best way to use some sort of brush on a picture, then sample the color values?
I'm using C# .Net, but I don't need a fully working code (I can make that) - so any sample/hints will be good.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 HSL 色彩空间。
当 L 为 0 时,您会得到黑色,当 L 为 1 时,您会得到白色。您可以将 H 从 0 更改为 1 以更改色调(或颜色)。这是为了最大饱和度(S = 1)。
这是映射的示例。要使用 HSL 颜色,您需要将其转换为 RGB。
You can use the HSL color space.
When L is 0 you get black, and when L is 1 you get white. You can vary H from say 0 to 1 to change the hue (or color). This is for maximum saturation (S = 1).
Here is an example of a mapping. To use the HSL color you need to convert it RGB.