Generated syntax theme css files should use variables

So I’m making a theme that has a darkmode button and I’d like to have the syntax highlighting change with the rest of the theme. This is of course more than possible, but requires generating the css files, then copy-pasting all the colors into variables. It would be nice if a single file with variables for all the different colors for each theme could be generated so I could switch between them with JS.