Fundamentals of Computer Science I: Media Computing (CS151.02 2007F)

Assignment 5: Colors in Context

Due: 4:00 p.m., Friday, 14 September 2007
No extensions!

This homework is also available in PDF.

Summary: In this assignment, you will use the transformations you learned in the reading and lab on transforming RGB colors to construct images that let one explore colors in context.

Purposes: To give you further practice using the color transformations. To explore ways to generalize and automate actions. To experiment with ideas from the lecture on color theory.

Expected Time: One hour

Collaboration: You must work in a group of size two or three. You may discuss this assignment and possible solutions with anyone you wish. If you discuss this assignment with people other than group members, make sure to include a citation (e.g., I consulted this person, who helped me do this).

Submitting: Email me your answer. More details below.

Warning: So that this assignment is a learning experience for everyone, I may spend class time publicly critiquing your work.



The Theory: Relationship Between Colors

In his guest lecture on Monday, Professor Kluber gave us some terminology for describing relationships between colors For example, a color scheme can be complementary, analogous, monochromatic, or discordant. As some of you suggested in the followup discussion, it should be possible to compute other colors in a color scheme from a starting color.

Kluber also encouraged us to think about how colors can look different depending on the context in which they appear. At the end of class, we explored one technique for building images that let us test that hypothesis.

The Practice: Transforming Colors

Do we know how to compute complements, analogs, and other variants of a color? We know some ways. In particular, we can use the basic color transformations that were discussed in the reading on transforming RGB colors. For example, to compute the complement of a color, subject, we might use (rgb.complement subject).


Write Scheme instructions that permit you to view a single color in different contexts. Begin by using define to associate the name subject to the color we will explore. For example, you might write something like

(define subject (cname->rgb "violet"))

Next, write Scheme instructions to create nine different 3x3 images. The center pixel of each image will be subject. In one image, all of the remaining pixels will be the same color. However, that color will differ from image to image.

The colors you should use for the non-center pixels are as follows.

Although you may want to experiment using DrScheme's interactions pane, you should write the final version of your instructions in DrScheme's definitions pane. This way, if you've written your instructions well, you should be able to change the definition of subject, click the Run button, and see the new subject color in all nine different contexts.

Important Evaluation Criteria

I will primarily look at whether your instructions are correct, automatic (that is, you did not need to copy and paste any results), and general (that is, one set of instructions works for any color as fgcolor). I will also look at how you make use of the transformation procedures and how you find a discordant color scheme.

Submitting Your Homework

Please submit this work via email. The email should be titled CSC151.02 Assignment 05 and should contain your code from the definitions pane.

Please send your work as the body of an email message. I don't like attachments, and prefer not to receive them when they can be avoided. You certainly need not attach the images you created as I should be able to recreate them by running your code.



Monday, 10 September 2007 [Janet Davis]

Monday, 10 September 2007 [Samuel A. Rebelsky]

Monday, 17 September 2007 [Samuel A. Rebelsky]


Disclaimer: I usually create these pages on the fly, which means that I rarely proofread them and they may contain bad grammar and incorrect details. It also means that I tend to update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This document was generated by Siteweaver on Mon Dec 3 09:55:55 2007.
The source to the document was last modified on Mon Sep 17 09:33:17 2007.
This document may be found at

You may wish to validate this document's HTML ; Valid CSS! ; Creative Commons License

Samuel A. Rebelsky,

Copyright © 2007 Janet Davis, Matthew Kluber, and Samuel A. Rebelsky. (Selected materials copyright by John David Stone and Henry Walker and used by permission.) This material is based upon work partially supported by the National Science Foundation under Grant No. CCLI-0633090. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation. This work is licensed under a Creative Commons Attribution-NonCommercial 2.5 License. To view a copy of this license, visit or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.