Graphics

Summarized using AI

Rainbows! Color Theory for Computers

Lito Nicolai • November 10, 2016 • Cincinnati, OH

The video titled 'Rainbows! Color Theory for Computers' features Lito Nicolai presenting at RubyConf 2016. The talk delves into the intricacies of color theory as it applies to computer graphics, particularly in data visualization. Throughout the presentation, Nicolai emphasizes the importance of color in design, user experience, and visualizations, exploring how to effectively represent information through color. Key points include:

  • Introduction to Color Theory: The speaker introduces the Ruby graphics gem, developed by Ryan Davis, which allows for creative visualizations by manipulating color data. Nicolai discusses the usage of the gem to create appealing graphical representations of data.

  • Fluid Dynamics Simulation: An overview of a fluid dynamics simulation based on Smooth Particle Hydrodynamics is presented. This simulation exemplifies how pressure and movement can be visually represented, enhancing understanding through color mapping, where different pressure levels are assigned specific colors.

  • Understanding RGB and Color Perception: Nicolai explains the mechanics of light perception in humans, involving the rods and cones in our eyes and how they relate to computing color. He details how computers utilize red, green, and blue (RGB) color models to display a full spectrum of colors, emphasizing the biological basis of color perception.

  • Color Mixing and the Color Cube: The concept of a color cube is introduced, demonstrating how colors can be derived from mixing RGB components. Nicolai offers methods for creating smooth color gradients in graphics programming, which is crucial for effective visualizations.

  • Helmholtz-Kohlrausch Effect: The talk addresses the complexities of brightness perception across different colors, detailing how this can affect visualizations. Nicolai discusses theories surrounding this phenomenon and its implications for color display in computer graphics.

  • Cube Helix Color Scheme: A practical application of the discussed theories was demonstrated with the Cube Helix color scheme, which provides a clear and visually appealing approach for color transitions while preserving data integrity.

  • Differences in Color Systems: Nicolai concludes by highlighting the differences between various color systems (such as RGB, CMYK, and paint mixing) and their applications. This illustrates the challenges faced when transitioning between these systems due to the distinct ways colors are produced and perceived in different mediums.

The talk ultimately advocates for a deeper understanding of color dynamics to enhance data visualization techniques, emphasizing the artistic and analytical aspects of color representation in computing.

Rainbows! Color Theory for Computers
Lito Nicolai • November 10, 2016 • Cincinnati, OH

RubyConf 2016 - Rainbows! Color Theory for Computers by Lito Nicolai

We often use color as a way to add information, whether in design, in UX, or for visualizations. When we visualize information, what's the best possible color scheme to use? How can we display the most possible information?

The only way to know is to explore the nature of color! We'll build up to the color-handling code that exists in 'graphics.rb', a Ruby-language visualizations library. For free, we'll end up with intuitive models of computer color spaces and tricks for how to think about common color concepts like gradients and paint mixing.

RubyConf 2016

00:00:15.130 Thank you all so much for coming. This is 'Rainbows!' My name is Lito, and I work at Carosone. You can find me on Twitter at @LitoNicolai. This talk uses a lot of visualizations and specifically utilizes the Ruby graphics gem, which was written by Ryan Davis. He shared it with everyone in the Seattle Ruby community and encouraged us to show what we could do with it. This talk is a result of everything I did with that gem.
00:00:21.680 It's currently in beta, so when you install the gem, you'll need to use the command 'gem install graphics --pre'. Additionally, this entire talk is hand-drawn, aside from the computery bits and the code. I attempted to draw the QR code portion manually, but it didn't turn out too well. So, from here on out, we'll proceed with the drawings.
00:01:01.370 This demonstration shows a simulation of fluid dynamics, which is based on particles that each have their own pressure. I learned about this simulation from the work of an incredible Ruby programmer named Usayd Kiyando, who created a fascinating simulation entirely in C, executed in the terminal. This simulation won the obfuscated 'C' contest. I'm employing a similar model known as Smooth Particle Hydrodynamics, which is a simplified method originally designed for astronomers to simulate stars colliding with each other. It prioritizes the visual watching of interactions over rigorous physical accuracy.
00:01:15.590 There's so much more information in this simulation that we're not observing. For example, if we wanted to visualize what happens concerning turbulence, we might want to show how fast each of these particles is moving. My favorite feature is the pressure of each particle, which reveals precisely what would occur in the model. It calculates the pressure around each particle and pushes them away based on notable high or low-pressure regions.
00:02:02.330 We can map pressure readings to visual elements. For instance, if we have 100 kilopascals—a typical atmospheric pressure—we can represent that with a shade of gray. As we move up in pressure, say for readings of around 90 kilopascals, we might designate that as black. The highest numbers, around 120, would be the brightest shades displayed. This mapping is now built into the Ruby graphics gem code.
00:02:38.239 As we visualize the pressure of the simulation, the brightest spots represent where the water crashes downward, indicating areas of high pressure, while low-pressure regions appear darker. While this is effective, I prefer cooler colors. The primary goal is to create beautiful representations of data. So, how can we transition from just a number, such as brightness, to a complete spectrum of colors? Computers essentially recognize only red, green, and blue.
00:04:01.220 Images on CRT screens are composed of these three primary colors. Different devices use pixels with variations of red, green, and blue. For example, this laptop utilizes red, green, and blue LED lights, while the projector we are using employs a rotating color wheel of the same colors. So how do we represent a full spectrum of light using just these three colors, and how is it possible to generate all colors from them? The answer lies in biology.
00:04:18.530 When light reaches our eyes, it is processed by two distinct types of cells. One type, the rods, responds solely to brightness, capturing intensity. Meanwhile, cones detect different wavelengths, giving us the perception of color. We possess three kinds of cones: red, green, and blue. Some individuals have two types of cones, leading to color blindness, while a few might have more cones, resulting in enhanced color vision.
00:05:23.630 So we have these specialized cells in our eyes, each tuned to different types of light, which helps us interpret colors. In computing, we usually represent colors on a scale of 0 to 255. Some may be more familiar with hexadecimal notation ranging from 00 to FF. When colors are displayed, you will commonly see references to red, green, and blue in web design as a six-digit hex number.
00:05:55.970 Our brains have a unique way of processing these colors. For instance, when we see yellow, our eyes interpret it as a combination of red and green wavelengths. So visually, our brain identifies this mixture and perceives it as yellow. However, what we see on a computer screen is actually an interplay between red and green light, while a lemon reflects yellow wavelengths.
00:06:41.000 When blue and green light combine, we perceive cyan by mixing those two colors. On the other hand, when we see magenta—created by red and blue—our brain fabricates a color as there is no green wavelength present to bridge the two, leading to a perception of magenta, which doesn't actually exist in light.
00:07:19.430 Our brain interprets the presence of red, green, and blue wavelengths as a full spectrum, even though it is not. In reality, no pure white light is present, just those three colors. But, perceiving all colors as a blend helps us navigate light perception more accurately. Consequently, the concept of a color cube emerges, representing all colors that can be perceived by combining red, green, and blue light.
00:08:09.320 From this position, you can visualize walking around the edge of the color cube, transitioning between intense colors like red to yellow or blue. The idea of it is to use only a number on the spectrum and convert it to a triplet of red, green, and blue values, creating smooth transitions.
00:08:51.680 There are easy implementations for this in Ruby graphics. You can create gradients by blending two colors seamlessly, moving along the edge of the cube or even interpolating through it for colors opposite each other on the cube. Achieving a smooth gradient is simple in Ruby graphics.
00:09:06.630 However, different colored values can visually appear with vastly differing brightness levels despite sharing the same luminance. This phenomenon is known as the Helmholtz-Kohlrausch effect, and while various theories exist to explain it, the understanding is still limited. Notably, colors that should seemingly possess equivalent light reflectivity can looking dissimilar and can often be perceived differently than their background.
00:09:51.240 One theory suggests that color perception may not be a simple combination of signals. Instead, we might perceive red and green independently, and only then calculate an aggregate lightness for the perceived color. For instance, when combining red and green light, our eyes interpret this conjunction to be bright, leading to the perception of yellow.
00:10:06.240 We can use this information to enhance our understanding of color mixing. By graphing light intensity against wavelengths, we could draw lines showing regular brightness levels or saturation within the color cube, but such methods can be complicated mathematically.
00:10:37.410 Fortunately, astronomer Dave Green proposed a solution: a color scheme that transitions smoothly across the spectrum while maintaining clarity for scientific applications. The principle involves using existing brightness formulas from standards set by television guidelines to help visualize color transitions more effectively without over-complicating the calculations.
00:11:09.300 Utilizing Ruby graphics, I learned to develop a model that elegantly transitions from dark to light while passing through defined colors. The result is known as the Cube Helix. By establishing color values around the cube efficiently and executing the results, I successfully found a visually appealing palette that still carries meaningful data.
00:11:42.300 Despite how fascinating this method is for displaying color data, many remain confused by color systems differing entirely from RGB, particularly those used for printing, such as cyan, magenta, and yellow (CMYK), or when taught to paint with primary colors like red, blue, and yellow. Those differences in color theory often stem from contrasts in application—what squeezes back light and how mediums absorb and reflect colors differently.
00:14:05.760 In painting, for instance, pigments work by subtracting light in converse ways compared to projecting colors. Various pigments have unique chemical properties, which frequently result in muddier mixes with additional colors, confirming that it's not as straightforward as producing a specific hue of color. This foundational understanding is perhaps why beginners are often instructed to paint with only red, blue, and yellow.
00:14:28.878 Thank you so much for your time. That's all I have.
Explore all talks recorded at RubyConf 2016
+82