There’s fundamentally two ways. First is what you just stated with the modifier. The second way is to redefine the colors with CSS vars and then write a normal CSS media class that re-wires what var means what color.
That's what I would do and use the dark: classes for adding borders and other styles that make dark themes work. F.e. shadows and floating cards doesn't really work with dark themes but does with light colors.