Tunable structural color generation from vertical silicon nanowires arranged in different square lattices is demonstrated. The generated colors are adjustable using well-defined Bragg diffraction theory, and only depend on the lattice spacing and angles of incidence. Vivid colors spanning from bright red to blue are easily achieved. In keeping with this, a single square lattice of silicon nanowires is also able to produce different colors spanning the entire visible range. It is also shown that the 2D gratings also have a third grating direction when rotated 45 degrees. These simple and elegant solutions to color generation from silicon are used to demonstrate a cost-effective refractive index sensor. The sensor works by measuring color changes resulting from changes in the refractive index of the medium surrounding the nanowires using a trichromatic RGB decomposition. Moreover, the sensor produces linear responses in the trichromatic decomposition values versus the surrounding medium index. An index resolution of 10−4 is achieved by performing basic image processing on the collected images, without the need for a laser or a spectrometer. Spectral analysis enables an increase in the index resolution of the sensor to a value of 10−6, with a sensitivity of 400 nm/RIU.