Three lights, 0 to 255 each
A screen pixel gives off red, green and blue light, and RGB sets how bright each one is. Your eye blends the three into one color. That makes RGB an additive model: all three at zero is black, and all three at full is white. Light adds up where ink and paint take light away.
With 8 bits per channel, each value is a whole number from 0 to 255. rgb(124, 58, 237) is 124 red, 58 green and 237 blue. Blue is the strongest channel and green the weakest, which gives a violet. Equal channels make a gray, and red plus green light without any blue makes yellow, rgb(255, 255, 0).
Writing RGB in CSS
CSS has two spellings. The modern one separates the channels with spaces and puts alpha after a slash: rgb(124 58 237 / 50%). The older one uses commas: rgb(124, 58, 237). The first is the violet #7C3AED at half opacity, and the second is the same violet fully opaque. rgba() is an alias for rgb() and does the same job.
A channel can also be a percentage, where 100% means 255, so rgb(100% 0% 0%) is pure red. The modern form lets you mix numbers and percentages. The comma form needs all three channels to use the same kind. Values outside the range are clamped, not rejected.
How many colors the bits allow
At 8 bits per channel there are 256 levels of each, and three channels multiply to 16.7 million colors. That's the figure usually quoted for 8-bit color. A panel with 10 bits per channel reaches 1074 million. Whether you can see the extra steps depends on the screen and on what's shown, and panels differ in color depth, so check the spec of yours.
Where RGB gets awkward
RGB matches how a screen works, not how people think about color. Making a color lighter or darker means changing all three channels, and it's hard to predict by eye what that will do. CSS Color 4 notes that matching sets of colors are easier to build in HSL than by working with sRGB channel values. OKLCH goes a step further with lightness that follows what you see.
In CSS, rgb() always means sRGB, and so do hex and hsl(). The choice between them is about how you edit, not which colors you can reach. Colors beyond sRGB, like the wider range of Display P3 screens, are written with color(), for example color(display-p3 1 0 0).