Similar Color Shades codes - css

If I see a particular shade of red on a website, how do I find out what the same shade will be in a different color? Example in Green or such?

To see the same shade (saturation and brilliance) in different hues, convert the color to HSV or HSB, and then increment/decrement the Hue value.
This web page describes how to convert RGB to HSV, and even includes sample C code.
http://en.literateprograms.org/RGB_to_HSV_color_space_conversion_%28C%29
...Though you might find more useful algorithms/snippets on the web.
http://www.google.com/search?q=Convert+RGB+to+HSV

Related

Hex to color name

I want to tag color names based on hex or rgb values. I found this amazing site ( http://www.color-blindness.com/color-name-hue/ ) but the thing is there are so many color names and main color hues are insufficient. I would love to have a solution to name RGB or HEX for like 40-50 well known colors.
Any idea will help me, thank you
This one will be useful, you will have to parse this json to use it in your project.
I wrote a command-line tool that does exactly that: Cict
Example:
$ ./cict 000081
1 #000080 navyblue
As you can see, you simple pass a 24-bit hex-value to cict and it reports the distance to the color found (1 in this case), the value of the actual color (#000080) and the name (navyblue).

PyQtGraph GLScatterPlotItem: How to make colors opaque

In PyQtGraph, GLScatterPlotItem, I would like the points to not blend color together when the points overlap. I want to see the closest point, and not the ones behind.
I have asked for the colors to be opaque (alpha = 1.0), but when the dots in a plot overlap, the color just turns a shade of magenta, even if all the points in that region arevery similar color.
Here's an example:
plt = gl.GLScatterPlotItem(pos=coords, color = colors, size=5, pxMode=True)
where colors are a sort of 'heat map' that range from red to blue.
The plot I get is this:
You can see there is some red, but everywhere the points really overlap, the color goes weird.
On the other hand, if I do the simple modification of size=1, then the colors are nice, but the dots are tiny, and can be hard to see:
This is exactly the same data both time. You can start to see a little of the magenta color over to the left and rear where point desity is high, but other than that, the colors are correct.
How can I prevent the magentification of my plots?
Thanks a bunch!
OpenGL is probably rendering dots additively and saturating. Try:
plt.setGLOptions('opaque')
I ran into this as well; the default options are pretty for volumetric data, but aren't great for dense point clouds from surfaces. If you figure out something even better, i.e. local patches with illumination, post back about it!

R/quantmod: how to specify the bollinger bands colour?

This could be more generally be How to change the theme colours? Or maybe TA colours are not controlled by theme?
This makes bollinger bands with a nice cloud effect:
chartSeries(bars, theme="white")
addBBands()
(See example of how it looks (near the bottom) )
The cloud effect is dark grey on this next example, so almost invisible.
chartSeries(bars, theme="black")
addBBands()
How do I change it to be, say, a nice bright red, with bright purple for the upper and lower lines? (Yeah, I know, -1 for the colour scheme)
I believe I'll be able to specify an 8-hex-digit colour to specify semi-transparency. But can I do anything more exotic? E.g. it would be rather cool to use a gradient and have it #ff0000 at the centre, fading to #330000 at the upper and lower lines. Is there any gradient support in quantmod charting?
A look at chartTheme seems to indicate that a gradient is not possible, but the up/down colours can be specified, as can the respective border colours. Just define your own theme as per the examples. You can start with the predetermined theme and modify certain individual parameters.
Fleshing out Benjamin's answer and my own learnings, here is an example:
#bars is an XTS object, OHLC data
library(quantmod)
chartSeries(bars)
addBBands(n=20,sd=2)
addBBands(n=50,sd=1)
The above draws two bollinger bands, in default colour scheme. The following will change them to be a semi-transparent red (i.e. the red is stronger where they both exist):
t=chartTheme()
t$BBands$fill="#ff666633" #20% red (i.e. hex 33 is the transparency)
reChart(theme=t)
From my study of the source this should have worked to change the line colours:
t$BBands$col=c('red','blue','green')
But it does not. However you can change the top/bottom colours to the same colour with:
t$BBands$col='blue'
reChart(theme=t)
And here is how to do the same with the newer chart_series() function, and notice you can set the line colours individually (NB. there is no reChart function, as far as I can see):
t=chart_theme()
t$bbands$col$fill="#ff000033"
t$bbands$col$upper='red'
t$bbands$col$lower='green'
t$bbands$col$ma='blue'
chart_Series(bars,theme=t)
add_BBands(n=50,sd=1)
add_BBands(n=20,sd=2)
It is not possible, as far as I know, to use a different colour scheme for each of the two bollinger bands. Even changing the colour scheme like this fails, as after the second command it redraws both with the new colours!
obj=chart_Series(bars)
add_BBands(n=50,sd=1)
obj$Env$theme$bbands$col$fill="#00ff0033"
add_BBands(n=20,sd=2)

Colour patterns or functions, pyxplot

I'm using a program called pyxplot and I'm doing some colourmaps.
To specify the colors, I can use RGB, HSB or CMYK patterns using
set colourmap ( rgb<r>:<g>:<b> |
hsb<h>:<s>:<b> |
cmyk<c>:<m>:<y>:<k> )
All values goes from 0 to 1 and that specifies a color for the f(x,y) = c1 function.
For example, I can do
set colourmap rgb(c1):(0):(0)
and it gives me a colourmap from white to red (red for values of c1 that are 1, white for 0)
I want to know if someone has an idea to form some color patterns (or if someone has some reference) like the 'jet' of Matlab of this page http://www.mathworks.com/help/techdoc/ref/colormapeditor.html
Because I try to combine colors but i can't get nice patterns.
I could do
set colourmap hsb(0.5*c1+0.1):(1):(1)
and it gives me from orange to blue on hsb range of colours, but, what if I want other colours in the range?
You're quite right that it didn't used to be very easy to produce custom color scales in Pyxplot 0.8. But it is now possible to do it in version 0.9.
You need to set up a palette with a list of the colors you want along your scale. Then, rather than setting a color map in terms of RGB or HSB components, set it as an integer, to read a color from the present palette. If your palette has five colors in it, you want:
set colormap (5-1)*c1+1
For more information, including an example, see
http://pyxplot.org.uk/current/doc/html/sec-palette.html
You can use a colormap of linear interpolation between colors:
dark blue (0,0,0.5), blue (0,0,1), cyan (0,1,1), yellow (1,1,0), red (1,0,0), dark red (0.5,0,0).
This is mostly the "jet" like colormap (if you omit dark blue and dark red colors) but look a bit more interesting. Exactly this color scheme is used by default in MathGL (GPL plotting library).
HSB is probably the best and easiest color system to play with, in particular the Hue (H) component as you tried. It should start with red, continue with yellow, green, cyan, blue, magenta and return to red.
You should easily get the other colors if you simplify your colormap to (assuming that c1 goes from 0 to 1):
set colourmap hsb(c1):(1):(1)
The current formula 0.5 * c1 + 0.1 for the H component restricts it to the range from orange via yellow, green and cyan to blue.

Finding set of colours that are distinguishable to each other

I am writing a graph plotting program. I thus am looking ways to obtain colours that are distinguishable to each other in order to plot various graphs in one cell.
Is there an algorithm or some website that obtains rgb values that matches this criteria?
EDIT: I am looking for 16 different colours
For an automatic solution, you can take one color as the base color and obtain good matching colors by changing the hue in the HSV/HSB color space. If you need 4 colors for example you could rotate the hue by 90° for each color.
If the number of lines on the graph isn't too large (i.e. you can pick colours by hand), I rather like this (http://colorschemedesigner.com/) for choosing colours that work together, but stand out from each other.

Resources