Fifty Shades of Gray: The SQL and PowerShell

Phil was struck by a comment by a DBA on a Simple-Talk article that complained that the PowerShell examples weren't simple enough. The traditional "hello world" was too simple (that's actually the program), but he was suddenly struck by the literary fuss over 'Fifty Shades of Gray' to decide to do a 'Fifty Shades of Gray' Wallchart in both TSQL and PowerShell.

I felt it would be a good idea to do a ‘Fifty Shades of Gray’ wallchart using both SQL and PowerShell to generate the HTML that then could be saved to file,  rendered on a browser and printed out. What better way of introducing PowerShell to those Database Professionals faced with having to learn PowerShell who pine for the equivalent of a ‘Hello World’ example. It turned out to be very simple, almost trivial, but useful nonetheless. It is, of course, handy to have the chart at hand to refer to for those awkward web-design jobs.

Here is the SQL:

The PowerShell is even simpler. I’ve written it to use the same basic algorithm, so as to be more easily compared.

Both these will render the wallchart as follows. (I’ve altered the code only slightly in order to play safe in the website, but I’ve attached the output, the PDF wallchart,  as well as the source,  to the article in the speechbubble at the top)

Fifty Shades of Gray.

You’ve read the book, now here is the colour chart. Each shade is accompanied by its hue and its name, so that it can be used directly in HTML.  FiftyShadesOfGray