Home Web Front-end CSS Tutorial CSS basic tutorial---RGB additive color description

CSS basic tutorial---RGB additive color description

May 16, 2016 pm 12:06 PM
rgb illustrate

rgb colors are called additive colors because you create white by adding r, g, and b together (that is, all the light is reflected back to the eye). additive colors are used in lighting, televisions and computer monitors. for example, displays produce color by emitting light from red, green and blue phosphors.

the vast majority of the visible spectrum can be expressed as a mixture of red, green, and blue (rgb) colors of light in different proportions and intensities. when these colors overlap, cyan, magenta, and yellow are produced.

additional color (rgb)

r. red g. green b . blue
you can manipulate color values ​​by using the rgb color mode, which is based on the rgb color model. in rgb mode, each rgb component can take a value from 0 (black) to 255 (white). for example, a bright red uses an r value of 246, a g value of 20, and a b value of 50. when all three component values ​​are equal, a shade of gray is produced. when all components have a value of 255, the result is pure white; when the value is 0, the result is pure black.

the method of encoding a color is collectively called a "color space" or "color gamut". in the simplest terms, the "color space" of any color in the world can be defined as a fixed number or variable. rgb (red, green, blue) is just one of many color spaces. with this encoding method, each color can be represented by three variables - red, green, and the intensity of blue. when recording and displaying color images, rgb is the most common solution. however, it lacked good compatibility with early black and white display systems. therefore, a common practice adopted by many electronic and electrical manufacturers is to convert rgb into yuv color space to maintain compatibility, and then change back to rgb format as needed to display color graphics on computer monitors.

since web pages (web) are media developed based on computer browsers, the colors are mainly optical colors rgb (red, green, blue). web page color is represented by a hexadecimal code. the general format is #zyzabc (letters are replaced by numbers). for example, black has three colors of 0, and the web page code is: #000000. when the color code is #xxyyzz, it can be represented by #xyz. for example, #135 and #113355 represent the same color.

rgb()

the function will represent the three primary colors of red, green and blue the three integers are combined into a long integer representing the color.

syntax:

RGB ( red, green, blue )
Copy after login

parameters:

red: integer type, specifies the intensity of the red component in the color, valid values ​​are between 0 and 255

green: integer type, specifies the green component intensity in the color, the valid value is between 0 and 255

blue: integer type, specifies the blue component intensity in the color, the valid value is 0 return value long between 255 and 255.

when the function executes successfully, it returns the color determined by the specified component, expressed as a long integer. returns -1 on error. if the value of any parameter is null, the rgb() function returns null.

usage:

the rgb() function uses the following formula to calculate the long integer representing the color: 65536 * blue 256 * green red where blue represents the blue component and green represents the green component. , red represents the red component. among each component, the smaller the value, the lower the brightness, and the larger the value, the higher the brightness. for example, rgb (0, 0, 0) is black (the lowest brightness), and rgb (255, 255,255) is white (the highest brightness).

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the rgb color mode? What is the rgb color mode? Feb 13, 2020 pm 02:08 PM

RGB is the color mode of light. R represents red, G represents green, and B represents blue. The three colors can be superimposed to form other colors, so this mode is also called additive color mode.

What is the difference between rgb and argb What is the difference between rgb and argb May 05, 2023 am 11:56 AM

The difference between rgb and argb is: 1. RGB is a color standard in the industry. Various colors are obtained through changes in the three color channels of R, G, and B and their superposition. The lighting effect is relatively simple. ARGB has a built-in control chip on a single RGB lamp, which can be programmed to achieve effects such as running water lamps and spliced ​​display of text patterns, achieving dynamic transformation like running water; 2. ARGB uses 5V3 pins to control a single lamp bead, while RGB is 12V4 pin, it can only achieve single-color conversion; 3. ARGB lighting effect motherboards are more expensive than RGB.

What is the RGB color mode? What is the RGB color mode? Feb 28, 2023 pm 04:01 PM

The RGB color mode is a screen display mode; on the monitor, the RGB color mode produces colors by hitting the red, green, and blue light-emitting electrodes of the screen with an electron gun. Computers can generally display 32-bit colors, with about a More than a million colors. The RGB color mode is a color standardization mode that uses the three basic colors of red, blue and green to produce other colors by superimposing and mixing them in different ways. These three colors are also the three primary colors that produce other colors, and can form all seen color.

What does monitor rgb mean? What does monitor rgb mean? Feb 14, 2024 pm 09:00 PM

Many people don't understand the RGB values ​​​​in the monitor description. They don't know what they mean. In fact, this tells you the color mode level of the monitor. There are up to 256 levels that can achieve 16 million colors through combination. What does monitor rgb mean? Answer: Color mode 1. RGB refers to the changes in the three colors of red, green, and blue, and their combination and superposition can produce a variety of colors. 2. The representative of RGB in general computers is the display color representation method. There are 256 levels of RGB in total. 3. 256 levels can combine a total of 16.78 million colors, which is often called 16 million colors, also called 24-bit colors (2 to the 24th power) 4. If you see a percentage of RGB values, such as 99%RGB, this represents the color gamut of the monitor

What is the difference between cmyk and rgb What is the difference between cmyk and rgb Feb 03, 2023 pm 02:26 PM

Differences: 1. CMYK is composed of four colors, Cyan, Magenta, and Yellow; RGB is composed of three primary colors of light, red, green, and blue. 2. CMYK is a color mode that relies on reflection, and can only be seen with an external light source; RGB is a luminous color mode, and the content on the screen can still be seen in a dark room. 3. The image displayed on the screen is expressed in RGB mode; the image seen on the printed matter is expressed in CMYK mode.

rgb to hexadecimal rgb tutorial rgb to hexadecimal rgb tutorial Jun 21, 2023 pm 05:50 PM

The three primary colors of RGB color are very likely to be used in interface programming. In most cases, it is necessary to convert the decimal number of the color into a hexadecimal value. For developers with low digital sensitivity, manual conversion is often error-prone. , which brings a huge burden to them. This article introduces how to use the calculator tool that comes with Windows to convert decimal and hexadecimal RGB.

Hexadecimal coding comparison table Hexadecimal coding comparison table Jun 21, 2023 pm 05:53 PM

When it comes to the decimal system for numbers, the "decimal system" that immediately pops up in our minds in life is often used, but in "Computer Coding Binary System" we talked about the use in modern computer systems.

What does computer rgb mean? What does computer rgb mean? Jan 30, 2023 pm 02:37 PM

Computer rgb refers to the RGB color mode, which is a color standard in the industry. It obtains each color through changes in the three color channels of red (R), green (G), and blue (B) and their superposition. A variety of colors; RGB represents the colors of the three channels of red, green, and blue. This standard includes almost all colors that human vision can perceive, and is one of the most widely used color systems.

See all articles