In short: the GDPR doesn't mention it but it is covered by the ePrivacy directive/regulations which does cover cookies very specifically, and which is enforced through GDPR.
What does "enforced through GDPR" mean here? That if you don't ask permission for saving a dark mode preference, they'll fine you for misuse of personal data even though it isn't personal data and you're not misusing it?
You read and replied to my other response. It answers this question and gives you the laws you demanded and the terms to research the answer to this question.