This is for a Self Hosted environment. I have previously tried to find information on how to control the colors on the pie chart using modern dashboards as having blue or pink for up wasn't visually appealing and confused upper leadership when they noticed it. With the help of AI I was able to find how to do this and am posting what I learned to possibly help others. This may have been obvious, but I am not savvy at writing scripts and tend to fumble my way through them. If someone else has posted this information then I didn't see it.
This is the SWQL for the Hardware Health pie chart by status, but this can be used for most anything that needs controlled colors. As you can see below, adding Case StatusDescription and assigning Hex codes (#1b5e20') for each status and ending this as Color will allow you to control the color of the pie graph. You can look up more hex codes if you don't like the colors I have listed here and switch them out with the ones listed after Then. To then have the pie graph use the colors you will need to choose color mapping and then Color on the custom screen when editing. If you don't see the option click on your custom SWQL and then the drop down boxes should appear below it with color mapping being one of them.
SELECT
StatusDescription,
COUNT(*) AS StatusCount,
-- Custom Hex Color Mapping
CASE StatusDescription
WHEN 'Up' THEN '#1b5e20' -- Deep Forest Green
WHEN 'Critical' THEN '#d32f2f' -- Ruby Red
WHEN 'Warning' THEN '#f39c12' -- Orange/Yellow
WHEN 'Unknown' THEN '#1e90ff' -- Lighter, vibrant cobalt Blue
WHEN 'Could Not Poll' THEN '#95a5a6' -- Gray
ELSE '#7f8c8d' -- Default Dark Gray
END AS [Color],
CONCAT('/Orion/HardwareHealth/Resources/redacted', StatusDescription, 'redacted link- you can find at the end of the previous link in your environment') AS StatusLink
FROM Orion.HardwareHealth.HardwareInfo
GROUP BY StatusDescription
ORDER BY StatusCount DESC