Read data in CSS

I am building a python plotly dash webapp. I am using colors and fonts to style it, and I’d like these colors to be easily changeable. For now I need to declare them both in my python and css codes, as I used plotly for the graphs and css for the styling of some elements. Is there a wy to declare them in a single place, so that I dont have to change colors and fonts at several places. I am thinking something like a json file, which I can easily parse in python but dont know how to parse in css .

For now:

Python code:

color1 = "rgb(0, 63, 114)"
color2 = "rgb(0, 97, 152)"
font = "SourceSansProRegular"

CSS code:

:root {
    --dark-blue: rgb(0, 63, 114);
    --light-blue: rgb(0, 97, 152);
    --font: "SourceSansProRegular";

Maybe you could have your CSS be the “source of truth” and you read the CSS files from Python to get the colours? There are some Python CSS parsers our there such as tinycss (disclaimer: I’ve not used it).

This sounds like a good idea ; I will try and let you know