
6-digit hex value: As an example "#ffd700" is the same as "Gold".The list of supported colors appears later in this topic. CSS color name: "RoxyBrown" and "OliveDrab" are examples.The ColorValue function returns a color based on a color string in a CSS. You can find a list of these colors at the end of this topic. Descriptionīy using the Color enumeration, you can easily access the colors that are defined by HTML's Cascading Style Sheets (CSS). If you want to play around with your color directly in the browser, try hsl.Use built-in color values, define custom colors, and use the alpha channel. If you want some transparency, convert your color from hex to rgba, and use the rgba color unit.

If you don’t intend to use any transparent color, stick to hexadecimal values, as they are easier to copy/paste and don’t take much space in your code. In CSS, you only need to prepend a hexadecimal color value with a hash #. It is easier to copy paste a single field than 3 separate ones. Hexadecimal values are easier to copy and paste, as they only comprise 6 characters. You either use a color picker, or copy/paste it from Photoshop, or choose a colour palette somewhere. Usually, when choosing colors, you don’t write them directly. Just like RGB, a hexadecimal color value is a combination of Red, Green, and Blue, each of them being represent as a hexadecimal value, like DB for Red, 4E for Green, and 44 for Blue.īecause Red, Green or Blue can only have 2 symbols, their possible values are 16 * 16 = 256, which mirrors the RGB color unit! Why not use RGB then? The most important thing to remember is that there are 16 hexadecimal symbols. Not at all! It is here to provide an explanation of how hexadecimal values work. the number 16 in hexadecimal is 10 because after you’ve run out of symbols (the last one being F), you add a second symbol to the left and increment ( 0 becomes 1) and the right one starts over (from F to 0).Because 0-9 are not enough symbols, we also use A-F. In hexadecimal, we have 16 symbols to form numbers.

To understand what hexadecimal values are, let’s look at how binary and decimal work:Ĭonsider the 0-9 numbers and the A-F letters as symbols. body Ĭolors in CSS can also be defined with hexadecimal values, like #db4e44. Color namesĬSS provides 145 colors names, from the most basic (black, white, orange, yellow, blue…) to the more specific (lawngreen, orchid, crimson…). What is more important is the different types of color units available. The color property defines the color of the text. Colors are widely used in CSS, whether for text color, background color, gradients, shadows, borders… There are several ways to define colors in CSS, each with their own pros and cons.
