search
HomeWeb Front-endCSS TutorialCSS basic tutorial---RGB additive color description

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 )

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
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
rgb颜色模式是一种什么模式rgb颜色模式是一种什么模式Feb 13, 2020 pm 02:08 PM

RGB是色光的色彩模式。R代表红色,G代表绿色,B代表蓝色,三种色彩叠加可以形成其它的色彩,因此该模式也叫加色模式。

rgb和argb区别是什么rgb和argb区别是什么May 05, 2023 am 11:56 AM

rgb和argb区别是:1、RGB是工业界的一种颜色标准,通过R、G、B三个颜色通道的变化以及相互之间的叠加来得到各式各样的颜色,灯光效果比较单一,而ARGB在单个RGB灯上内置了控制芯片,可以通过编程实现实现流水灯、拼接显示文字图案等效果,实现流水般动态变换;2、ARGB采用5V3针,可以控制单个灯珠,而RGB是12V4针,只能实现单色的变换;3、ARGB灯效主板比RGB贵。

显示器rgb什么意思显示器rgb什么意思Feb 14, 2024 pm 09:00 PM

很多人对于显示器说明的RGB数值表示不了解,不知道什么意思其实这是告诉你显示器的色彩模式等级,最高有256级能够通过组合达到1600万种的颜色。显示器rgb什么意思答:色彩模式1、RGB是指红、绿、蓝三种颜色的变化以及它们的组合叠加能够得到各种各样的颜色。2、一般电脑中的RGB代表就是显示器颜色表示方式,RGB一共有256种级别。3、256级能够组合出一共1678万种色彩也就是常说的1600万色也叫24位色(2的24次方)4、如果是看到有百分比的RGB数值,比如99%RGB,这是代表显示器的色域

RGB颜色模式是一种什么模式RGB颜色模式是一种什么模式Feb 28, 2023 pm 04:01 PM

RGB颜色模式是一种屏幕显示模式;在显示器上,RGB颜色模式是通过电子枪打在屏幕的红、绿、蓝三色发光极上来产生色彩的,电脑一般都能显示32位颜色,约有一百万种以上的颜色。RGB颜色模式是一种颜色标准化模式,通过红蓝绿三个基础颜色,通过对它们进行不同的叠加混合产生其它的颜色,这三种颜色也是产生其它颜色的三基色,能够组成所有见过的颜色。

cmyk和rgb的区别是什么cmyk和rgb的区别是什么Feb 03, 2023 pm 02:26 PM

区别:1、CMYK由四色构成,青色Cyan、品红色Magenta、黄色Yellow;RGB由色光三原色构成,红色red、绿色green、蓝色blue。2、CMYK是一种依靠反光的色彩模式,需要有外界光源的情况下才可以看到的;RGB是一种发光的色彩模式,在一间黑暗的房间内仍然可以看见萤幕上的内容。3、屏幕上显示的图像,采用RGB模式表现;印刷品上看到的图像,采用CMYK模式表现。

rgb转16进制rgb教程rgb转16进制rgb教程Jun 21, 2023 pm 05:50 PM

RGB色彩三原色在界面编程中用到的概率非常高,大部分情况下会需要将色彩颜色的十进制数字转换成十六进制值,对于那些数字敏感度比较低的开发者,手工转换经常容易出错,给他们带来了巨大的负担,本文就介绍如何使用Windows自带的计算器工具转换十进制和十六进制RGB。

16进制编码对照表16进制编码对照表Jun 21, 2023 pm 05:53 PM

说到数的进位制,生活中的我们脑海里马上闪现的往往是“十进制”,但是在“计算机编码二进制”中我们讲了现代计算机系统中采用。

电脑rgb什么意思电脑rgb什么意思Jan 30, 2023 pm 02:37 PM

电脑rgb是指RGB色彩模式,是工业界的一种颜色标准,是通过对红(R)、绿(G)、蓝(B)三个颜色通道的变化以及它们相互之间的叠加来得到各式各样的颜色的;RGB即是代表红、绿、蓝三个通道的颜色,这个标准几乎包括了人类视力所能感知的所有颜色,是运用最广的颜色系统之一。

See all articles

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

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!