PDFs generally do not use #000000ff or SVG structures (those are designed for HTML long after PDF was designed)
So decompressing a PDF you would have problems seeking that colour, Luckily you are not attempting all 4 as that would perhaps be a mammoth PDF editor task deciding which change and which do not.
So in a PDF rgb stroke is probably like all Black objects [0 0 0] or 0 0 0 rg or RG, or one of many other methods. Thus without your sample no way to tell exactly what needs to change but #b5b5b5 is in CMYK set as cmyk(0%, 0%, 0%, 29%) or RGB = 0.29 0.29 0.29
Both those values are likely many bytes more than the black entry which could be as short as say = 1 K. This is a major problem when PDF cannot simply be edited as one byte more or one byte less and not corrupt the objects index (xref in the tail).
In this very simple case we can instantly see, save
0 1 0 rg will make ALL black green (NOTE the number of bytes did not change, we just toggled green on from off)
However edit as
0.29 0.29 0.29 rg will usually corrupt the file.
You have 3 fairly easy options.
use a command line tool like cpdf and tell it to turn black objects grey, however it is like cracking walnuts with a precision jack hammer, it needs a light touch [on] paper and run (joke). It should work in this case to turn ALL fills to the desired 50 shade of grey ?
Decompress the PDF with say mutool, and use a text editor in one small area (like I did) and save then use
mutool clean in.pdf out.pdf to heal the rift. OR if the rift is minor Acrobat will open the file and offer to rewrite on save but that's slow as one at a time.
build a script that can be called with each filename in turn
Here are the steps in a windows console (fart-it is a SourceForge FnR tool)
Apps\PDF\mupdf\1.20.0>mutool clean -d rainbow.pdf decompressed.pdf
Apps\PDF\mupdf\1.20.0>copy decompressed.pdf decompressed.pdf.bak
Overwrite decompressed.pdf.bak? (Yes/No/All): y
1 file(s) copied.
Apps\PDF\mupdf\1.20.0>fart -b -B -- decompressed.pdf "0 0 0 RG 0 0 0 rg" "0 0 0 RG 0.29 0.29 0.29 rg"
Warning: fart may corrupt binary files
Replaced 1 occurence(s) in 1 file(s).
Apps\PDF\mupdf\1.20.0>mutool clean -z decompressed.pdf output.pdf
error: cannot recognize xref format
warning: trying to repair broken xref
warning: repairing PDF document
- Do it with a graphics scalpel tool like inkscape.