Colors and Typography
Ketan Mayer-Patel
UNC Department of Computer Science
COMP 426: Modern Web Programming (Fall 2026)
Module 5: Design
Lecture 20
Colors
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
M5: Design
L20
Anatomy of a Color
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
M5: Design
L20
Anatomy of a Color
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
M5: Design
L20
Hue
Anatomy of a Color
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
M5: Design
L20
Saturation
Anatomy of a Color
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
M5: Design
L20
Brightness
Color Representations
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
M5: Design
L20
rgb(160,120,140) Values range from 0-255
#3F89CC Values range from 0-FF (0-255 in hexadecimal)
hsl(160,100% ,50%) Hue values range from 0-360 (degree on color wheel)� Saturation + brightness values range from 0-100%.
Another Value: Alpha
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
M5: Design
L20
rgba(160,120,140,0.5) Alpha value ranges from 0-100%.
#3F89CC3C Alpha value ranges from 0-FF.
hsl(160,100%,50%,0.5) Alpha value ranges from 0.0-1.0.
Creating a Color Palette
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
M5: Design
L20
Creating a Color Palette
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
M5: Design
L20
Save Changes
Cancel
Creates a hierarchy of importance / “weight” of action.
The “Save Changes” button performs a mutating action, the “Cancel” button does not.
Look! These animated pop ups have different prominence levels...
60-30-10 Rule
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
M5: Design
L20
Primary
Accent
Secondary
Generating a Color Palette
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
M5: Design
L20
Pitfalls!
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
Or something like this…
M5: Design
L20
Pitfalls!
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
… especially on top of each other! X _ x
M5: Design
L20
Pitfalls!
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
M5: Design
L20
Dark Mode
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
M5: Design
L20
Dark Mode
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
M5: Design
L20
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
Typography
M5: Design
L20
and branding of your site!
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
Types of Fonts
M5: Design
L20
Aa
Serif
Aa
San Serif
Aa
Handwritten
Aa
Monospaced
Aa
Display
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
Types of Fonts
M5: Design
L20
Aa
Serif
Aa
San Serif
Aa
Handwritten
Aa
Monospaced
Aa
Display
Serif��Typeface that includes serifs (the small decorator lines) at the extremities of the letters.
Oftentimes, the width of each stroke in the letter may not be uniform.
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
Types of Fonts
M5: Design
L20
Aa
Serif
Aa
San Serif
Aa
Handwritten
Aa
Monospaced
Aa
Display
San Serif��Typeface that excludes serifs.
The width of each stroke in the letter is often uniform.
Used as the standard font type for many websites!
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
Types of Fonts
M5: Design
L20
Aa
Serif
Aa
San Serif
Aa
Handwritten
Aa
Monospaced
Aa
Display
Handwritten��Typeface that looks like it was handwritten or written in calligraphy.
This is not commonly used for text on websites, but is commonly used in logos (when giving a personal touch is appreciated!)
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
Types of Fonts
M5: Design
L20
Aa
Serif
Aa
San Serif
Aa
Handwritten
Monospaced
Aa
Display
Monospaced��Typeface where every character shares the same width.
Often looks like a typewriter font.
Often used to represent code.
This is how I have used it for slides!
<p>Hello, world!</p>� � vs <p>Hello, world!</p>
Aa
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
Types of Fonts
M5: Design
L20
Aa
Serif
Aa
San Serif
Aa
Handwritten
Aa
Monospaced
Aa
Display
Display��Typeface that is fancy and striking, drawing the user’s attention.
This is not commonly used for body on websites, but is may be used for titles or high-prominence headers (<h1>!)
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
Typography
M5: Design
L20
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
Anatomy of a Font
M5: Design
L20
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
Line Spacing, Character Spacing, and Kerning
M5: Design
L20
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
Another Cool Feature: Drop Cap
M5: Design
L20
You often see this on news articles, web novels, etc!
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
Choosing Type
M5: Design
L20
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
100
200
300
400
500
600
700
800
900
We usually just think of normal and bold - but there are many more options!
Important: Font Weights
M5: Design
L20
Thin Extra Light Light Normal Medium Semibold Bold Extra Bold Black
COMP 426: Modern Web Programming (Fall '26)
Colors and Typography
Applying Typography
M5: Design
L20