The rgb() function is an inbuilt function in CSS that is used to define the colors using the Red Green Blue (RGB) model.
Syntax:
rgb( red, green, blue )
Parameters: This function accepts three parameters as mentioned above and described below:
- red: This parameter is used to define the intensity of the red color. It is an integer value that lies between 0 to 255, or as a percentage value between 0% to 100%.
- green: This parameter is used to define the intensity of the green color. It is an integer value that lies between 0 to 255, or as a percentage value between 0% to 100%.
- blue: This parameter is used to define the intensity of the blue color. It is an integer value that lies between 0 to 255, or as a percentage value between 0% to 100%.
Example: The below programs illustrates the rgb() function in CSS:
Output:
👁 Image
Supported Browsers: The browser supported by rgb() function are listed below:
- Chrome
- Edge
- Firefox
- Safari
- Opera