“Because that, when they knew God, they glorified Him not as God, neither were thankful; but became vain in their imaginations, and their foolish heart was darkened.” —Romans 1:21
The statement that “they knew God” means that they knew about Him. They knew that He was filled with wrath against all ungodliness and unrighteousness; yet they refused to glorify Him as God. They refuse to be accountable to Him, neither did they give Him thanks, even though, by God’s grace, “He did good, and gave [them] rain from heaven, and fruitful seasons, filling [their] hearts with food and gladness” (just as Paul preached to the people of Lystra in Acts 14:17).
As a result, they “became vain in their imaginations, and their foolish heart was darkened.” In other words, they became idolatrous in their considerations and their hearts were darkened… as opposed to enlightened because “God is light, and in Him is no darkness at all” (1 John 1:5). Jesus told Nicodemus, “And this is the condemnation, that light is come into the world, and men loved darkness rather than light, because their deeds were evil. For every one that doeth evil hateth the light, neither cometh to the light, lest his deeds should be reproved” (John 3:19-20).
So, fallen, sinful men not only know who God is and know about His holy justice, but they also know enough about Him to hate Him utterly and completely (Romans 1:30).