Color hex calculation - colors

I have a picture, i choose a color on the picture like:
#18212d
rgb: 24 33 45
when i colorize that picture by increased hue with 6 (202 => 208), saturation with 4 (25 => 29) (using photoshop), old color above was turned into new color:
#19232c
rgb: 25 35 44
Have any ways to calculate a new color of another old color after colorized? I need that to colorize all my css file.

You need to convert all your colors to HSV, manipulate it and convert it back to RGB. You need to understand how different color system works. This page is a good reference,
http://www.easyrgb.com/index.php?X=MATH
This page lists all the algorithms. You can also find open source code in just about any language you use. For Javascript, Dojo, YUI all have conversion functions built-in.

Related

Convert RGB Color in SVG to Spot Color in PDF

we are building an web application to design print products online. There are also some special finishes available for print. For example gold foil. There for we have to define the color in the final PDF in a specific way. It has to be a spot color with 100% magenta (c0 m100 y0 k0) and th color name "goldfoil".
In the design tool we are using a color with a hex code that is looking similar to gold in the browser (#9C9475). Our application is creating SVG that is converted via ghostscript to the PDF.
What I now want to achieve is to define a fallback or exchange color for specific hex colors like in this example #9C9475 that will convert this color in the PDF to the above described spot color.
Will this be possible? I found an article that svg 1.1 and above is supporting ICC Profiles and can produce CMYK and ICC named colors. In the documentation it says that I can define spot color in this way:
<color-profile name=„ISOcoated_v2_eci" xlink:href="http://swatches.example.com/ISOcoated_v2_eci.icc"/>
<circle fill=„#9C9475 icc-color(ISOcoated_v2_eci, Goldfolie"/>
But then I am missing the CMYK values.
Can somebody help me in this case?

Color listing in xterm terminal

I installed a minimal debian and i'm trying to set everything by myself, so i'm trying to tune my default terminal Xterm by giving it some colors, after some research i found that this can be done either by editing the .Xresources file so i can give the first 16 colors in Hexa code (#numbers) or by editing the .bashrc file.
After some research seems like the second solution is more dynamic 'cause i can specify the colors of files by extensions, the problem is that all the articles on the net use a color code very weird :
.gz 01;31
.bz2 01;31
.deb 07;31
.rpm 01;31
.jar 01;31
I want to know if there's a way to use RGB code color or hexa color so i can have more flexibility with my directory and files listings.
AFAIK, there is no RGB support, terminal emulators are limited to display a limited set of colors (a palette with 64 combinations of foreground and background, if I'm not mistaken). If ease of use is what concerns you, you can always declare several variables for the predefined colors, something like:
readonly BLACK_FONT_BLACK_BACKGROUND='30;40'
readonly BLACK_FONT_RED_BACKGROUND='30;41'
readonly BLACK_FONT_GREEN_BACKGROUND='30;42'
readonly BLACK_FONT_YELLOW_BACKGROUND='30;43'
...
readonly WHITE_FONT_CYAN_BACKGROUND='37;46'
readonly WHITE_FONT_WHITE_BACKGROUND='37;47'
And use them later like:
.gz $BLACK_FONT_YELLOW_BACKGROUND
The following is a table with the color codes for foreground and background:
Color Foreground Background
-------------------------------
black 30 40
red 31 41
green 32 42
yellow 33 43
blue 34 44
magenta 35 45
cyan 36 46
white 37 47
-------------------------------
If generating all the color names variables manually is too tedious, you can use the following python script:
colors = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white'];
index = 0
for x in ["{0}_FONT_{1}_BACKGROUND='{2};{3}'".format(colors[i].upper(), colors[j].upper(), i + 30, j + 40) for i in xrange(0, 8) for j in xrange(0, 8)]:
print x.ljust(38) + "#" + str(index)
index += 1
I'm sorry, but you can't use the RBG color code (or HSV, or HCL). You may find the documentation with:
$ man 5 dir_colors
As noted by #Leonardo Fontenelle, the place to start reading about GNU ls coloring is the dir_colors manual page. The numbers used, such as 01;31 are the constants associated with what the manual page refers to as "ISO 6429 (ANSI) color sequences". Actually the manual page is a little more obscure than it ought to be:
the constants are parameters used in the ISO 6429 SGR (set graphic rendition) control sequence. The actual standard is very detailed (see ECMA-48).
01 happens to be the standard code for bold (the manual refers to it using the Linux-centric "brighter colors*).
as noted by #higuaro, codes 30-37 and 40-47 form a color palette; all of the colors shown on the terminal at any moment come from the current palette.
there is more than one way to update the color palette used by xterm; none of those are directly related to the ls configuration because the numbers used for referring to the palette do not contain the color information by themselves.
you can display the colors and video attributes using the ncurses tput utility, e.g., tput setaf 7.
some (relatively) recent ls configurations use additional color codes outside the 30-37 / 40-47 palette, e.g., for the aixterm 16-color feature, or the xterm 88-colors or 256-colors. The dir_colors manual page does not mention this.

What is the difference in representing colours this way #ffffff and 0xffffff?

Sorry if its a newbie question but entering new territory and google hasn't been very helpful and would love a fresh description
Thank you
The way we represent colors is dependent on the system we try to use this color value. I do not know what language you're refering to in your question, but you can find #ffffff used in CSS, while integer form 0xffffff can be seen in different programming languages.
You may wonder why it is in HEX?
Just because it's easier to see the value of the color, as it's being presented in a way of 255 bytes for each color respectively. So, you can see that 0xff0000 is a pure red. Compare it to value of 16711680 - this is the same value but it does not tell you what color it is.
Every web/css developer can spot the pattern here*:
#ffffff, #cccccc, #aaaaaa, #999999, #666666, #333333, #000000
As it's just set colors from White to Black and some shades of gray in between.
Hope this helps!
*for CSS in particular, the above pattern should be written as:
#fff, #ccc, #aaa, #999, #666, #333, #000

How can I change lightness hue and partially desaturate an image in ImageMagick?

I have a PNG which (besides a white spot and transparency in the background) is a pretty straight blue.
I would like to use convert from ImageMagick to partially desaturate it, so that I can create images with the original blue at one extreme, and regular desaturation (I know that color theory allows a lot of desaturations, but I'm just looking for GIMP-style desaturation.)
I would also like to lighten or darken the colors to an image.
Lastly, I would like to change the hue for the bulk of the images, to anything on the hue scale. (The image is a saturated blue.)
I can do all of these in GIMP but I am looking for a way to automate the process. I also want to resize down, but that much was clearer from the docs.
How can I do these adjustments?
This might help. It uses this image as input - I am not so artistic and is a pretty literal interpretation of your teardrop image description...
#!/bin/bash
for hue in $(seq 0 40 160); do
for sat in $(seq 20 40 100); do
convert -label "Sat:$sat,Hue:$hue" input.png -modulate 100,$sat,$hue miff:-
done
done | montage - -frame 5 -tile 3x m.png

Tiny "Color Code" problem

I'm a student and recently I'm making a website in order to share the course with others
And I got a problem:
I'm trying to express the "Course Heat Degree" by color
(now all the color is bule in the following picture)
now I get a course_heat_num from the server but I have no idea how to use it cause I want the
"cool color"(like #cc00ff) represent small course_heat_num and "warm color"(like #ff0000) represent the big number
I don't know the function or the variation in the chang from the cool color to the warm color(BTW:not from #000000 to #FFFFFF)
Hope Someone can help!
You might want to look at HSL colours in the CSS3 Colour Module.
It allows you to express colours as Hue, Saturation, and Lightness instead of RGB values. In your example, blue would be hsl(0, 100%, 50%) but red would be hsl(249, 100%, 50%). You can vary between 0 and 249 for the hue parameter.
To get an idea of what the colours look like, try the HSL Color Picker.
You should check out the wiki, here are a number of ways for you to go.
Pick a technique, and calculate the proper color, it should be nice.

Resources