Color Triangle

Setup

Notes
  • Size is the length of one side of the triangle.
  • Top, Left, and Right must be 6-digit hex values, or you can choose by clicking on the colors provided.
  • Red is FF0000, Green is 00FF00, Blue is 0000FF.
Setup

Notes
  • Size is the length of one side of the triangle.
  • Top, Left, and Right must be 6-digit hex values, or you can choose by clicking on the colors provided.
  • Red is FF0000, Green is 00FF00, Blue is 0000FF.

The Purpose

This program draws a triangle that shows the blending of three colors. These three colors can be specified by the user and are drawn at the vertices of the triangle.

I originally implemented this in C++ for the Macintosh, then ported it to run in PHP on the web. I wrote this final implementation in Javscript to allow the program to be run standalone (without need for a web server).

New features in this JavaScript implementation:

Evaluation

This was one of the very first programs I wrote in JavaScript, and it shows. At the time, I didn't use much CSS and I wrote the styles directly into the HTML. Also, I used old HTML4 constructs like cellspcing and cellpadding. And I used tables a lot to lay things out, which in this particular case, is not really so bad. But my coding style has changed a lot since these days.