This might work for manmade righteousness, for telling (lying to) yourself that you are a good person, but the judgment of God described in the Bible sees righteousness in an entirely different way. Perhaps a good picture to use would be wet paint.
If white is good, and black is bad, measure out how much white you think you have, and put it on the canvas. Then measure out how much black you think you have (be honest), and put it on the canvas. While the paint is still wet, mix all that you are, and all that you’ve done together. No matter who you are – your own view of yourself ends up gray. All your white is tainted by your black.
The problem is that God demands purity. Perfection. Goodness. Not good with a little bad – not pure with a little impurity. Not godly with a little “well I’m human.” According to your own righteousness, you are dirty, stained, mixed up.
But God saw you in your problem, before you knew about it. He took action to save you from it before you even asked Him. And His salvation is something entirely incredible. God doesn’t save you by making you a good person or by allowing you to have a righteousness of your own – He saves you by giving you His righteousness. By sharing His perfect, holy, pure Godly righteousness with you – in fact, He covers you with it. By sending His Son to die on the cross, God has laid Himself over top of your gray painted mess. He has covered it up with His own perfect canvas, one that is perfectly white, the righteousness of Christ. You are not reckoned righteous because you are – you are reckoned righteous because Christ is, and He has freely given His righteousness to you by faith. God no longer sees your gray mixed up slop, instead He sees His only Son, who pleases Him in every way.
Imagine that, you are completely free – freed by what Jesus did on your behalf. You no longer have to weigh your good against your bad, you no longer have to worry about your black tainting your white, you no longer are a slave to the work of proving yourself – for Christ died for you. Now you can do the right thing, simply because it’s the right thing to do – and remain confident that in Christ you have already been saved.