Color Codes for Google Spreadsheets

This Google Script converts the currently active Google Spreadsheet into a square grid of randomly colored boxes using hexadecimal numbers. Credit 五味田和則

The random colors are generated using a JavaScript method – Math.ceil(Math.random() * 0xFFFFFF).toString(16). Also, since the value of the cell is the same as the color code, you can copy a cell to copy its color code.