The best way probably is not try to auto-detect the environment that is less capable of handling some visual effects but give the user the possibility to switch into a less resource-intensive mode with an option somewhere on the page.
Most of the server & remote desktop users are more advanced than typical desktop users and more often looking for possible performance improvements (I personally instinctively turn off all the visual effects whenever I am connecting via remote desktop to a machine), so they will be willing to accept the option and placed wisely it won't distract the others.
In case you really want to detect user agent's setup, you could probably somehow try to measure javascript's performance or color depth as you've written. But I would really avoid this if you can.