In Apps Script you can use the DriveApp service to manage your files and folders, but the methods getColor and setColor do not exist. You can use the drive advanced service to query the API directly but with recent change you will have to activate the Drive API in GCP and will need a GCP project. To have a smooth integration and skip the Google Cloud project creation here is a function to manage Folder color in Apps Script. These functions queries the API directly with UrlFetchApp() service.
Source: Change Google Drive Folder color with Apps Script – Stéphane Giron – Medium
Member of Google Developers Experts Program for Google Workspace (Google Apps Script) and interested in supporting Google Workspace Devs.