In the SharePoint modern page, if you want to change the background color of the left navigation, you need to develop modern script editor web part in the site collection, then add CSS codes in the modern script editor web part.
First, download a compiled version from here, then enable this app and add it to all sites.
Go to the site collection, add the modern script editor web part on the page, add CSS codes in the modern script editor web part.
Similar question: https://learn.microsoft.com/en-us/answers/questions/749648/how-to-change-the-background-color-of-the-hub-navi
Reference: https://sharepoint.handsontek.net/2023/03/15/use-script-editor-modern-sharepoint-sites/
Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.