如何从给定的基色生成多个阴影? [英] How can I generate multiple shades from a given base color?

查看:166
本文介绍了如何从给定的基色生成多个阴影?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设计一个图表,并从一个单一的样本设置颜色
。与Excel中的方式相同:

I'd like design a chart and set the colors from a single exemplar. Same way as in Excel's:

是否有某种公式或算法给
从给定的
阴影或颜色生成下一个颜色?

Is there some sort of a formula or algorithm to generate the next shade of color from a given shade or color?

推荐答案

这看起来像我只是采取了相同的色调(基本颜色),并上下调整亮度。这可以通过HSL或HSV变换容易地完成。检查维基百科的HSL和HSV颜色空间,以了解所涉及的理论。

That looks to me like they just took the same hue (basic color) and turned the brightness up and down. That can be done easily enough with a HSL or HSV transformations. Check Wikipedia for HSL and HSV color spaces to get some understanding of the theory involved.

基本思想:计算机代表颜色与红色强度,绿色强度和蓝色强度,称为RGB,因为这是屏幕显示颜色的方式。 HSL(色调,饱和度,亮度)和HSV(色调,饱和度,值)是表示颜色的两种替代模型,它们更直观,更接近人类对颜色外观的思考方式。

Basic idea: Computers represent color with a mixture of red intensity, green intensity and blue intensity, called RGB, because that's the way the screen displays color. HSL (Hue, Saturation, Lightness) and HSV (Hue, Saturation, Value) are two alternative models for representing color that are more intuitive and closer to the way human beings tend to think about how colors look.

色调是基本色,表示(或多或少)为色轮上的角度。饱和度是一个线性值,从0(灰色)到255(明亮,鲜艳的颜色)。亮度/值表示从0(黑色)到100(白色)的亮度。

Hue is the basic color, represented (more or less) as an angle on a color wheel. Saturation is a linear value, from 0 (gray) to 255 (bright, vibrant color). And Lightness/Value represent brightness, from 0 (black) to 100 (white).

从RGB-> HSL和HSL->而不是HSL)是相当简单。尝试将您的颜色转换为HS *,调整亮度,并转换回来。通过从低到高采用几个不同的亮度值,并将它们排列为饼图中的楔形,您可以很容易地复制该图片。

The algorithms to transform from RGB -> HSL and HSL -> RGB (or HSV instead of HSL) are pretty straightforward. Try transforming your color to HS*, adjusting the brightness, and transforming back. By taking several different brightness values from low to high, and arranging them as wedges in a pie chart, you can duplicate that picture pretty easily.

这篇关于如何从给定的基色生成多个阴影?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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