@boltclock said it all, but you can save a bit of time if your project has a scss preprocessor.
You can do a little tweak to achieve what you want :
// Scss
@mixin defineColorRGB ($color, $red, $green, $blue) {
#{$color}: unquote("rgb(#{$red}, #{$green}, #{$blue})");
#{$color}-r: #{$red};
#{$color}-g: #{$green};
#{$color}-b: #{$blue};
}
Then in you css, you can do this:
::root {
@include defineColorRGB(--accentColor, red(#dfd0a5), green(#dfd0a5), blue(#dfd0a5));
}
You will end up with 4 different css variables, one for your color, and one for each color channel.
Then you can use it almost like you wrote it:
h1{
background: linear-gradient(
to right, rgba(255, 255, 255, 0),
rgba(var(--accent-color-r), var(--accent-color-g), var(--accent-color-b), 1)
);
}
I find it a very convenient way to initialize my css variables, and use it in most of my projects.