Probably you can edit/create ~/.config/gtk-3.0/gtk.css entry where you define the text color, but not sure how that will work on gtk2 as for this you will need more code … or gtk4 apps that now use libadwaita. Also, you might have some work to do for Qt apps too.
@define-color text_color #000000;
That concerns everyone. Gnome default Adwaita is decent already when comes to that, and for some of us, the dark variant is the way to go. For good contrast is not always a question of pure #000000 (black) and #ffffff (white) …
This might help as examples, the principle is the same: