Cap RGB value darkness by first converting to HSL, then applying threshold.
RGB values that were too dark to read against a black background are now viewable. This is done by converting the RGB values (from the hex values provided) to HSL, then moving any L (lightness) values beyond a certain threshold back. Finally they are converted back to RGB for display. In practice all this really does is to lighten the dark colors without changing their hue or saturation values (e.g. black becomes gray).
Thanks go to dmazary for helping me with this and working through the various bugs I found. Thanks, Dave!