Obviously you are not well familiar with everyday pro features such as adjustment layers and masks. I assume the most obvious case: You have painted onto a white background in the background layer itself, not created a new layer for the painting
If you have only black on white, you can colorize it with Image > Adjustments > Hue&Saturation, colorize crossed
before:

after:

The white background is not affected, if you have positive (+) Lightness.
A little more complex is the case where the lines are already colored and have different colors:

Let's assume you want to change green to blue. You can make selective color shift. Now only green is affected. The affected range can be adjusted with the sliders at the bottom:

Try it, but press cancel, because now it's the right place to take a step to pro methods and do this non-destructively.
Goto Layer > New Adjustment layer > Hue&Saturation

The new layer affects to the underlying image. The readjustment is possible with no side-effects. Only double-click the round half black-half white icon in the Layers panel to make the sliders available, if they have vanished because you have tried something else.
The white rectangle refers to the layer mask which is very useful if you want disable the layer on part of the image. There white=enable, black = disable.
Recommendations:
- Draw new shapes to new layers
- Learn to use adjustment layers and layer masks.
Note that my samples are from a legacy Photoshop. Modern versions have much more flexibility. That means also more controls to select from.