get lighter/darker shades of color Android


Color choosers are a dime a dozen online, but is a very nice one. Even then, finding lighter and darker colors in Photoshop is somewhat unintuitive due to it using HSV rather than HSL for its color picker. Its stated purpose is to allow you to specify a color and then find shades that are darker and lighter than that color. HSV(又称HSB)表示方法。它把颜色分为三个参量,一个是色相Hue,具体表示在色相环上的一种纯色,一个是饱和Saturation,具体表示纯色在颜色中的百分比,当S=1时,表示颜色最纯,当S=0时,表示灰度值。一个是亮度Value,表示颜色的亮度,当V=0时,表示黑色。 HSV颜色系统在不破坏图像结构的基础上更该颜色方面起着不小的作用。直接更改按钮的各个颜色的色相值,这样由于是整体更改颜色的色相值,各种颜色搭配还是比较协调的。



RGB 诉求于人眼对色彩的感应,YUV则着重于视觉对于亮度的敏感程度,Y 代表的是亮度,UV 代表的是彩度(因此黑白电影可省略UV,相近于RGB),分别用Cr和Cb来表示,因此YUV的记录通常以 Y:UV 的格式呈现。 第一个方案,是把 RGB 的值求和,然后取一个值,当和大于等于此值就为浅色: if ($R + $G + $B >= 450) { // add shadow } 这个算法很傻很简单,但效果不理想,特别是在 B 较大的时候,估计是眼睛对 RGB 各种颜色的敏感度都不一样。 可以使用YUV颜色编码来判断颜色的深浅。Y 是明亮度(灰阶),因此只需要获得 Y 的值而判断他是否足够亮就可以了:$grayLevel = $R * 0.299 + $G * 0.587 + $B * 0.114; if ($grayLevel >= 192) { // add shadow } 这个效果就是类似去 Photoshop 的去色功能


色差简单来说就是颜色的差别, 定量表示的色知觉差异。从明度色调彩度这三种颜色属性的差异来表示。明度差表示深浅的差异,色调差表示色相的差异(即偏红或偏蓝等),彩度差表示鲜艳度的差异。通过明度(L)、色调(A)和彩度(B)表示的颜色模型,称为LAB颜色模型,区别于RGB和CMYK颜色模型。


色差计算公式 A good way is to convert it to HSL color space, adjust the “lightness” component, and convert back to RGB. Another option is to use YUV color space, for which the calculations are easier. In YUV color space you can adjust darkness by changing the Y value.

sorting colors

Different people will sort a color palette in different ways. Our goal was to find a sorting mechanism that looked pleasing to the eye, but of course the results are completely subjective.

  • For aesthetics, we prefer the YIQ sort. It highlights trends in value change, but information about hue variation is hidden and sometimes invisible.
  • To communicate more information about hues, HSV sorting is by far superior, but it lacks the pleasant gradient-effect of the YIQ sort.
  • RGB sorting proves inferior to HSV and YIQ, though the results can still be interesting.
  • HSV sort is excellent for grouping colors of similar hues, but the IYQ and YIQ sorts also do this well and they can look cleaner than their HSV counterpart.


“web” palette sorted by saturation. see the sortpal pages for fuller versions.  It shows a set of color palettes, sorted by the various attributes like it’s redness, or brightness, or saturation. For example, in the “red” row, the reddest colors are at the far left and decreasingly red colors to the right. The width of the color depends on the number of colors in the palette.

Lots of ways to sort them mathematically. Some map well to what people perceive as correct. Some do not. e.g. web palette sorted by proximity in rgb colorspace:

Different color palettes can be chosen, including the 216 “web safe” palette (wiki), theX11/css “named” colors (wiki), the xkcd color survey (xkcd color survey), a rough approximation of the spot colors often used in print, a Hilbert curve through rgb space(wiki), misc artistic palettes, etc.

sorting methods:

  • Sorting by one component of a color space, the most obvious being the red, blue, green values of RGB:
  • Hue, saturation, and value (HSL and HSV) is another color space, that maps a lot more naturally to how people understand colors. e.g. web palette sorted by hue, saturation, value, lightness, respectively.

  • sorting by proximity in the 3d color space. The idea being to start at the origin, and find the closest colors in 3d.

The code is up at github. No promises to it’s correctness or functionality. secondary and tertiary parameters sort as well (hsv3d, and chroma ) mostly just to stabilize the sorts.

human color perception

RGB, HSV, CIE [59] XYZ, and Munsell [230] [79] color spaces doesn’t model human color perception adequately


People use these categories when thinking, speaking, and remembering colors: black, white, red, green, yellow, blue, brown, purple, pink, orange, and gray

Query-by-example, Query-by-color foundation: color discrimination and color memory.



【Thesis】Modeling human color categorization

The role of the user-interface (UI) is twofold.

  • First, the user must be able to define his query.
  • Second, the results of the search process must be presented in an appropriate manner.

Roughly, three levels of abstraction can be distinguished with image queries [9].

  1. Primitive features
  2. Derived features:
    • type of objects
    • object prototypes
  3.  Abstract attributes

Backgrounds of the semantic gap
– What are the user perception aspects?

– What are the system perception aspects?

How can the semantic gap be reduced?

Colour perception

Colour perception is a difficult and little understood problem, which seems to defy even the most ingenious mathematical expressions.

van Gogh exploits the psychological capacities of colors to arouse emotions

Our sensation is the most intense where two extremes are juxtaposed. Van Gogh’s Night Cafe composes colors described as “warm,” which are generally associated with such sensations and emotions as energy, joy, love and festivity. In his letter to his brother Theo, van Gogh considers the work as “…one of the ugliest (pictures) I have done… I have tried to express the terrible passions of humanity by means of red and green.”

Contrast this with the entry onPicasso and his “Blue Period,” where the paintings arouse emotions more usually associated with “cold” colors, such as sadness and a withdrawn quality.

Simultaneous contrast causes the white around the blue to seem yellow. Similarly, white light around a yellow beam will seem blue. Such effects are simple to demonstrate with a light beam and some colored filters. Finally, for blue alongside yellow, the blue makes the yellow more yellow and the yellow makes the blue more blue. Simultaneous contrast has its greatest effect for adjacent complementary colors.

Over the years, there have been several treatises on the practice, theory and philosophical issues of painting date, and notions about the use of color.

what’s the best choice for colormap

This is a difficult question because the best choice depends on the viewer’s task, on whether another visualization technique such as a height field is used in conjunction with color, and on the frequency content and noise within the data displayed.

Although the rainbow color map is universally inferior to other color maps, there is no color map that is better than all other maps in all circumstances.

The purpose of visualization is to effectively convey information to human viewers.

The selection of the best color map depends so critically on the data set and addressed questions that there is not a single best choice, but rather a collection of sets with different characteristics. The best solution would present the user with a choice whenever a color map is created, listing best types for each circumstance.

viewers can see details more readily when luminance contrast is present than when it is not.

Luminance is based on inputs from only the red and green channels—making it impossible to generate a uniform-luminance rainbow scale including deep blue.

The most obvious perceptually ordered color map with luminance contrast is the gray-scale color map.

Unfortunately, the early visual system converts from absolute brightness to brightness relative to surround, which distorts readings enough to produce errors of up to 20 percent of the entire scale



expert-crafted, algorithmically-generated, and default order

Chroma indicates how bright, saturated, vivid or colorful a color is. Formally, for any given color, reducing chroma to zero produces a gray of the same value. The maximum chroma for the color will vary with the color and the medium (display vs. print, for example)

On a display, the high chroma colors are vivid and bright, and unfortunately, the easiest to select in many applications. Using colors that are darker and grayer, or more pastel (closer to white), has many benefits.

Interactive systems and algorithms to guide color choices also exist, but they do not consider semantic associations between data values and colors. Prior work has optimized color mappings based on spatial frequency [BRT95], perceptual visibility [LSS12], color harmony [WGM08], and display energy consumption [CWM09]. Rheingans and Tebbs [RT90] introduced a tool allowing users to manipulate color mappings to visually explore and filter data. Lastly, other work has focused on generating palettes for artistic rather than visualization applications [MSK04,OAH11].

Selecting Semantically-Resonant Colors for Data Visualization

Choosing Colors for Data Visualization 

Maureen Stone
January 17, 2006

python convert rgb to hsv

The documentation of colorsys explains that all colour space coordinates are floating point numbers between 0.0 and 1.0 – rescale your values accordingly to get the desired results:

>>> h, s, v = colorsys.rgb_to_hsv(144/255., 190/255., 255/255.)
>>> 360 * h, 100 * s, 100 * v
(215.13513513513513, 43.529411764705884, 100.0)

colorsys.hls_to_rgb(h, l, s)

Convert the color from HLS coordinates to RGB coordinates.

import Imge,colorsys    
LenaImage1 ='lena.png')
r,g,b = LenaImage1.split()
Hdat = []
Ldat = []
Sdat = []    
for rd,gn,bl in zip(r.getdata(),g.getdata(),b.getdata()):
    h,l,s = colorsys.rgb_to_hls(rd/255.,gn/255.,bl/255.)

newimg = Image.merge('RGB',(r,g,b))'lenaHSV.png')

Hue describes the shade of color and where that color it is found in the color spectrum. Red, yellow, and purple are words that describe hue.
Figure 5.3
S. The saturation describes how pure the hue is with respect to a white reference.
S. The saturation describes how pure the hue is with respect to a white reference.  Saturation refers to the dominance of hue in the color. On the outer edge of the hue wheel are the ‘pure’ hues. As you move into the center of the wheel, the hue we are using to describe the color dominates less and less. When you reach the center of the wheel, no hue dominates.
One of the dimensions is lightness-darkness. How light or dark a color is is referred to either as a colors lightness or value.

These colors directly on the central axis are considered desaturated. These desaturated colors constitute the  grayscale; running from white to black with all of the intermediate grays in between.

Saturation, therefore, is the dimension running from the outer edge of the hue wheel (fully saturated) to the center (fully desaturated), perpendicular to the value axis

A horizontal slice of the model shown in Figure 9  creates a disk of the hues running around the perimeter. The farther down the value axis, the more restricted the saturation range (the radius of the disk) is and, therefore, the smaller the disk.

Another way you can slice the HSV model solid is vertically. If you took a slice along the saturation axis at a red hue, it might look something like Figure 10:

Figure 10 – A saturation/value slice of a specific hue in the HSV model

This wedge shows all of the saturation and value variations on this particular red. At the top of the wedge, the lightest red runs from high saturation on the right to white on the left. As you move down the wedge, the reds get darker and the saturation range from right to left gets narrower. We can take this theoretical wedge and actually try and see how many saturation and value variations on this red you can make. It might look something like Figure 11:

Figure 11 – Example saturation and value variations on a single red hue

The goal in Figure 11 was to create even increments of saturation going right to left and even increments of value top to bottom. This judgment was made by your ‘eye’, not by some numeric readout from a color mixing tool. Because you are using your ‘eye’, no one’s wedge would exactly like anyone’s else’s. Notice that the end result in Figure 11 is not a perfect triangle. Though more color squares could have been made for the darker reds, you would not have been able tell the difference in color between them. Similarly, if you removed some of the squares in the lighter value range, you would have to have made bigger steps of saturation to get the full range that you can see.




Just another site

Jing's Blog

Just another site

Start from here......







Just another site

Where On Earth Is Waldo?

A Project By Melanie Coles

the Serious Computer Vision Blog

A blog about computer vision and serious stuff

Cauthy's Blog

paper review...

Cornell Computer Vision Seminar Blog

Blog for CS 7670 - Special Topics in Computer Vision


Life through nerd-colored glasses

Luciana Haill

Brainwaves Augmenting Consciousness



Dr Paul Tennent

and the university of nottingham

turn off the lights, please

A bunch of random, thinned and stateless thoughts around the Web