fabric glue.
I didn't have any denim colored thread to patch my jeans so I used some of this ↓ and I'm not kidding you it never came off even after years & repeated washing until I had to throw them out because I didn't fit in them anymore (and I wasn't about to donate my threadbare glued up jeans)