Hex to web safe color converter5/3/2023 In the early years of the web, using “web-safe” colors was recommended. Programmers created the original World Wide Web along with the Hypertext Markup Language (HTML) that web pages are built on, so programmers expressed colors their way: with hexadecimal values. Instead of the familiar base-10 system (counting from 0 to 9), hex values are base-16 (counting from 0 to 9 then A to F). Hexadecimal values are convenient for programmers partly because are easy to convert to and from binary numbers. Web pages are built using computer code, which is fundamentally based on binary values. Video uses RGB color values based on the red (R), green (G), and blue (B) primaries in video displays. The earliest medium, print, uses CMYK color values based on the primary colors for inks on a press: cyan (C), magenta (M), yellow (Y), and black (K). Print and video existed before the web, so how did hexadecimal color become the way to describe colors on the web? In part it’s because of the way each medium developed. See also: Learn HTML Through Song Where Did Hexadecimal Color Values Come From? For example, you can specify some colors using hexadecimal values and some using RGB values as I’ve highlighted in the figure below. It’s OK to mix color value models in a CSS file. It’s also possible to specify RGB values as percentages, which is less common, but if you wanted to do that the example would look like this: background-color: rgb(60%, 20%, 80%) Using RGB color values, you can express the same color like this: background-color: rgb(153, 50, 204) Īs you can see, when specifying web colors as RGB values instead of hex values you need to remember these three things:Īs in Photoshop and other graphics software, each RGB value can be 0 (black) to 255 (white), based on the 256 levels available in each of the red, green, and blue color channels in 8-bits-per-channel RGB color. If you’ve been specifying hex colors up to now, the color code looks like this: background-color: #9932CC Suppose you’re setting the background color for an element in the Cascading Style Sheets (CSS) code that controls the look of your web site or mobile app. See also: Game Teaches Hexadecimal Colors How to Specify RGB Colors for the Web But “conventional” doesn’t have to mean “mandatory.” Entering colors as RGB values is actually allowed, and it’s easy to do. Hexadecimal color notation is taught as the conventional way to enter colors in HTML or CSS code. Working with hex color values can be an obstacle for an RGB-brained photographer or print designer trying to recognize colors in their code when building a website. But every web designer is taught to enter colors in hexadecimal values like #47B56C, which is like an alien language compared to the more traditional RGB and CMYK color values. If you’re a print designer, you may have learned how to see color in CMYK values. If you’re a photographer, videographer, or designer you probably think of color in RGB values such as 71,181,108.
0 Comments
Leave a Reply. |