Html color from rgb

RGBA Color Picker

A color space is a mathematical model used to represent physical colors. An RGB color space is a color space composed of three channels: red, green, blue, representing the three-dimensional information about the color. Each channel is represented by 8 bits, and the value of each channel is a value from 0 to 255.

The RGB color space is a combination of the red, green, and blue light components of additive color. The components of RGB are represented by the mathematical model:

R = red (0 ≤ R ≤ 255) G = green (0 ≤ G ≤ 255) B = blue (0 ≤ B ≤ 255)

In the RGB color space, the light intensity of each channel is equal to the value of each channel. For example, if the value of each channel is set to 255, the color of the visualized color space results in white. Also, if the value of each channel is set to 0, the color of the visualized color space results in black.

Equal values of each channel are represented by the same color in the RGB color space, but the combination of different values of each channel leads to different colors. The RGB color space is used to calculate the color of each pixel that can be displayed on the screen.

RGB 565 is an alternative representation of RGB colors that uses 16 bits to represent the color: 5 bits for red, 6 bits for green, and 5 bits for blue. This color space is used in some embedded systems, such as microcontrollers. To pick RGB 565 colors, check out our RGB 565 Color Picker.

RGB 0-1 or Float RGB is another alternative representation of RGB colors that uses three decimal numbers between 0 and 1 to represent the color: one each for red, green, and blue, and one for an optional alpha channel. To pick RGB 0-1 colors, check out our RGB 0-1 Color Picker.

To pick RGB/RGBA/Hex/HSL colors from an image (without uploading it to any server), check out our Image Color Picker.

RGBA Color Space

The RGBA color space is a color space that includes an extra channel (alpha channel) for representing the transparency information of an image. An RGBA color is composed of four channels, where each channel is represented by 8 bits. In RGBA, the transparency information is stored in the alpha channel, and the color information is stored in the three RGB channels.

The alpha channel can be displayed as a grayscale image. This means that the alpha channel is composed of 256 levels of transparency, where 0 represents the maximum level of transparency, and 255 represents the maximum level of opacity.

In the RGBA color space, the alpha channel is considered the same as a fourth channel, and the light intensity of each channel is equal to the value of each channel. For example, if the value of each channel is set to 255, the color of the visualized color space results in white. Also, if the value of each channel is set to 0, the color of the visualized color space results in black.

Equal values of each channel are represented by the same color in the RGBA color space, but the combination of different values of each channel leads to different colors.

The RGBA color space is used to calculate the color of each pixel that can be displayed on the screen. In addition, the alpha channel can be accessed in order to make an image transparent. This means that if the alpha channel has a value of 255 (opaque), it does not represent a transparent pixel.

Читайте также:  в части страницы.

Other Color Spaces

In addition to the RGB and RGBA color spaces, there are other color spaces that are widely used in programming:

CMYK: The CMYK color space is the color space that is used for printing. It is a color space composed of four channels, where each channel is represented by 8 bits. The CMYK color space is a subtractive color space, in which the color of each channel is created by subtracting the color of one channel from the remaining channels. At least one of the channels is black, and the color of this channel is known as the key color. The other channels are the colors mixed with the key color, and the color of each channel is determined by the amount of the key color mixed in.

HSV: This color space is used to represent the color of a single hue. It is represented by a position on a hue circle, saturation, and value.

HSL: This color space is used to represent the color of a single hue. It is represented by a position on a hue circle, lightness, and value.

LAB: This color space is used to represent the colors including the brightness of a given color. It is represented by a position on a curve, a lightness value, and a red/green/blue value.

Источник

Конвертер цветов

С помощью универсального конвертер цветов вы можете легко перевести цвет из одной цветовой модели в ряд других.

В первую очередь, калькулятор служит для удобной работы с современными форматами CSS3-цветов. Поддерживается конвертация из HEX в RGB/RGBA и HSL/HSLA, RGB в CMYK, XYZ, LAB, и обратно.

А также специальный функционал для замещения альфа-канала при переводе цвета из RGBA в RGB (и HSLA в HSL).

Справка по цветовым моделям

Далее приводится краткое описание цветовых систем с которыми работает конвертер, разъяснение по форматам, а также примеры использования полученных цветов в CSS/HTML.

HEX / HTML

Цвет в формате HEX — это ни что иное, как шестнадцатеричное представление RGB.

Читайте также:  Css custom select box

Цвета представляются в виде трёх групп шестнадцатеричных цифр, где каждая группа отвечает за свой цвет: #112233, где 11 — красный, 22 — зелёный, 33 — синий. Все значения должны быть между 00 и FF.

Во многих приложениях допускается сокращённая форма записи шестнадцатеричных цветов. Если каждая из трёх групп содержит одинаковые символы, например #112233, то их можно записать как #123.

RGB

Цветовое пространство RGB (Red, Green, Blue) состоит из всех возможных цветов, которые могут быть получены путём смешивания красного, зелёного, и синего. Эта модель популярна в фотографии, телевидении, и компьютерной графике.

Значения RGB задаются целым числом от 0 до 255. Например, rgb(0,0,255) отображается как синий, так как синий параметр установлен в его самое высокое значение (255), а остальные установлены в 0.

Некоторые приложения (в частности веб-браузеры) поддерживают процентную запись значений RGB (от 0% до 100%).

Цветовые значения RGB поддерживаются во всех основных браузерах.

RGBA

С недавних пор современные браузеры научились работать с цветовой моделью RGBA — расширением RGB с поддержкой альфа-канала, который определяет непрозрачность объекта.

Значение цвета RGBA задается в виде: rgba(red, green, blue, alpha). Параметр alpha — это число в диапазоне от 0.0 (полностью прозрачный) до 1.0 (полностью непрозрачный).

RGBA поддерживается в IE9+, Firefox 3+, Chrome, Safari, и в Opera 10+.

HSL

Цветовая модель HSL является представлением модели RGB в цилиндрической системе координат. HSL представляет цвета более интуитивным и понятным для восприятия образом, чем типичное RGB. Модель часто используется в графических приложениях, в палитрах цветов, и для анализа изображений.

HSL расшифровывается как Hue (цвет/оттенок), Saturation (насыщенность), Lightness/Luminance (светлота/светлость/светимость, не путать с яркостью).

Hue задаёт положение цвета на цветовом круге (от 0 до 360). Saturation является процентным значением насыщенности (от 0% до 100%). Lightness является процентным значением светлости (от 0% до 100%).

HSL поддерживается в IE9+, Firefox, Chrome, Safari, и в Opera 10+.

HSLA

По аналогии с RGB/RGBA, для HSL имеется режим HSLA с поддержкой альфа-канала для указания непрозрачности объекта.

Значение цвета HSLA задается в виде: hsla(hue, saturation, lightness, alpha). Параметр alpha — это число в диапазоне от 0.0 (полностью прозрачный) до 1.0 (полностью непрозрачный).

CMYK

Цветовая модель CMYK часто ассоциируется с цветной печатью, с полиграфией. CMYK (в отличие от RGB) является субтрактивной моделью, это означает что более высокие значения связаны с более тёмными цветами.

Цвета определяются соотношением голубого (Cyan), пурпурного (Magenta), жёлтого (Yellow), с добавлением чёрного (Key/blacK).

Каждое из чисел, определяющее цвет в CMYK, представляет собой процент краски данного цвета, составляющей цветовую комбинацию, а точнее, размер точки растра, выводимой на фотонаборном аппарате на плёнке данного цвета (или прямо на печатной форме в случае с CTP).

Например, для получения цвета «PANTONE 7526» следует смешать 9 частей голубой краски, 83 частей пурпурной краски, 100 — жёлтой краски, и 46 — чёрной. Это можно обозначить следующим образом: (9,83,100,46). Иногда пользуются такими обозначениями: C9M83Y100K46, или (9%, 83%, 100%, 46%), или (0,09/0,83/1,0/0,46).

Читайте также:  All javascript key codes

HSB / HSV

HSB (также известна как HSV) похожа на HSL, но это две разные цветовые модели. Они обе основаны на цилиндрической геометрии, но HSB/HSV основана на модели «hexcone», в то время как HSL основана на модели «bi-hexcone». Художники часто предпочитают использовать эту модель, принято считать что устройство HSB/HSV ближе к естественному восприятию цветов. В частности, цветовая модель HSB применяется в Adobe Photoshop.

HSB/HSV расшифровывается как Hue (цвет/оттенок), Saturation (насыщенность), Brightness/Value (яркость/значение).

Hue задаёт положение цвета на цветовом круге (от 0 до 360). Saturation является процентным значением насыщенности (от 0% до 100%). Brightness является процентным значением яркости (от 0% до 100%).

XYZ

Цветовая модель XYZ (CIE 1931 XYZ) является чисто математическим пространством. В отличие от RGB, CMYK, и других моделей, в XYZ основные компоненты являются «мнимыми», то есть вы не можете соотнести X, Y, и Z с каким-либо набором цветов для смешивания. XYZ является мастер-моделью практически всех остальных цветовых моделей, используемых в технических областях.

LAB

Цветовая модель LAB (CIELAB, «CIE 1976 L*a*b*») вычисляется из пространства CIE XYZ. При разработке Lab преследовалась цель создания цветового пространства, изменение цвета в котором будет более линейным с точки зрения человеческого восприятия (по сравнению с XYZ), то есть с тем, чтобы одинаковое изменение значений координат цвета в разных областях цветового пространства производило одинаковое ощущение изменения цвета.

Источник

RGB Color Codes Chart

Hover with cursor on color to get the hex and decimal color codes below:

RGB color space

RGB color space or RGB color system, constructs all the colors from the combination of the Red, Green and Blue colors.

The red, green and blue use 8 bits each, which have integer values from 0 to 255. This makes 256*256*256=16777216 possible colors.

Each pixel in the LED monitor displays colors this way, by combination of red, green and blue LEDs (light emitting diodes).

When the red pixel is set to 0, the LED is turned off. When the red pixel is set to 255, the LED is turned fully on.

Any value between them sets the LED to partial light emission.

RGB color format & calculation

RGB code has 24 bits format (bits 0..23):

RED[7:0] GREEN[7:0] BLUE[7:0]
23 16 15 8 7 0

RGB = (R*65536)+(G*256)+B , (when R is RED, G is GREEN and B is BLUE)

Calculation examples

White RGB Color

White RGB code = 255*65536+255*256+255 = #FFFFFF

Blue RGB Color

Blue RGB code = 0*65536+0*256+255 = #0000FF

Red RGB Color

Red RGB code = 255*65536+0*256+0 = #FF0000

Green RGB Color

Green RGB code = 0*65536+255*256+0 = #00FF00

Gray RGB Color

Gray RGB code = 128*65536+128*256+128 = #808080

Yellow RGB Color

Yellow RGB code = 255*65536+255*256+0 = #FFFF00

RGB color table

See also

  • RGB to hex converter
  • RGB to HSV converter
  • RGB to HSL converter
  • RGB to CMYK converter
  • Color conversions
  • Color wheel chart
  • Screen color tester
  • HTML color codes
  • HTML character codes
  • ASCII table
  • Unicode characters
  • Web safe colors
  • Yellow color
  • Gold color

Источник

Оцените статью