@maccesar/aiskills 1.9.2 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/package.json +1 -1
- package/skills/refactoring-ui/SKILL.md +31 -32
- package/skills/refactoring-ui/references/01-foundations.md +69 -0
- package/skills/refactoring-ui/references/02-page-mechanics.md +204 -0
- package/skills/refactoring-ui/references/03-visual-treatment.md +242 -0
- package/skills/refactoring-ui/references/04-polish.md +96 -0
- package/skills/stitch-showcase/SKILL.md +15 -11
- package/skills/refactoring-ui/references/01-design-process.md +0 -72
- package/skills/refactoring-ui/references/02-visual-hierarchy.md +0 -84
- package/skills/refactoring-ui/references/03-layout-spacing.md +0 -69
- package/skills/refactoring-ui/references/04-typography.md +0 -70
- package/skills/refactoring-ui/references/05-color.md +0 -96
- package/skills/refactoring-ui/references/06-depth-shadows.md +0 -74
- package/skills/refactoring-ui/references/07-images.md +0 -75
- package/skills/refactoring-ui/references/08-finishing-touches.md +0 -91
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Polish: Finishing Touches and Sharpening Intuition
|
|
2
|
+
|
|
3
|
+
Inspired by principles from *Refactoring UI* by Adam Wathan & Steve Schoger. Paraphrased into the maintainer's own words; the original prose, illustrations, and examples are in the book — refactoringui.com.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Replace Default Bullets with Meaningful Icons
|
|
8
|
+
|
|
9
|
+
- Default disc bullets feel generic and low-effort
|
|
10
|
+
- Swap for icons that match the content:
|
|
11
|
+
- Checkmarks for feature lists or completed items
|
|
12
|
+
- Arrows for sequential or directional lists
|
|
13
|
+
- Content-specific icons (lock for "secure", globe for "worldwide")
|
|
14
|
+
- Adds visual interest *and* reinforces meaning at the same time
|
|
15
|
+
|
|
16
|
+
## Big Quotation Marks as Decorative Elements
|
|
17
|
+
|
|
18
|
+
- For testimonials and pull quotes, quotation marks can become design elements rather than punctuation
|
|
19
|
+
- Make them large, colorful (accent color), positioned prominently
|
|
20
|
+
- The quote mark is now part of the visual design
|
|
21
|
+
|
|
22
|
+
## Style Links With Intention
|
|
23
|
+
|
|
24
|
+
Two paths depending on context:
|
|
25
|
+
|
|
26
|
+
1. **Color + weight:** brand-colored link with a slightly heavier weight than surrounding text
|
|
27
|
+
2. **Thick colorful underline:** a 2–4px border-bottom in an accent color that overlaps the lower portion of the text — clearly a link, visually distinctive
|
|
28
|
+
|
|
29
|
+
## Custom Checkbox and Radio Styling
|
|
30
|
+
|
|
31
|
+
- Browser default inputs look generic and break brand identity
|
|
32
|
+
- Build custom-styled checkboxes/radios using your brand color for the checked state
|
|
33
|
+
- Common pattern: custom checkbox = colored fill + checkmark SVG
|
|
34
|
+
- Worth the extra markup — defaults feel like 1996 every time
|
|
35
|
+
|
|
36
|
+
## Color Accents on Edges
|
|
37
|
+
|
|
38
|
+
A short, thick accent-color stripe is a high-impact, low-effort touch. Common placements:
|
|
39
|
+
|
|
40
|
+
- **Top of a card** — a colored bar at the top edge
|
|
41
|
+
- **Left side of an active nav item** — communicates "you are here"
|
|
42
|
+
- **Left side of an alert message** — color-codes the alert type (red=danger, yellow=warning, green=success)
|
|
43
|
+
- **Under a headline** — a short thick underline in brand color
|
|
44
|
+
- **Top of the entire page** — a thin strip of color across the very top
|
|
45
|
+
|
|
46
|
+
These add brand identity without adding complexity.
|
|
47
|
+
|
|
48
|
+
## Going Beyond a Plain Background
|
|
49
|
+
|
|
50
|
+
Options when "white" feels boring:
|
|
51
|
+
|
|
52
|
+
1. **Solid color shift:** switch from white to a brand-tinted neutral
|
|
53
|
+
2. **Gradient:** between two hues no more than 30° apart on the color wheel — close = natural, far = jarring
|
|
54
|
+
3. **Low-contrast repeating pattern:** subtle dots, lines, or hatching at low opacity
|
|
55
|
+
4. **Geometric shapes / blobs:** abstract colored shapes at low opacity behind content
|
|
56
|
+
|
|
57
|
+
Gradient rule of thumb: keep the two hues within ~30° of each other for a natural blend.
|
|
58
|
+
|
|
59
|
+
## Empty States Deserve Real Design
|
|
60
|
+
|
|
61
|
+
- Empty UIs look broken or confusing — and they're often the *first* thing new users see
|
|
62
|
+
- Design the empty state as deliberately as the populated one
|
|
63
|
+
|
|
64
|
+
A good empty state has:
|
|
65
|
+
|
|
66
|
+
- A contextually relevant illustration or icon
|
|
67
|
+
- A short, friendly explanation of what belongs here
|
|
68
|
+
- A clear next-step CTA (e.g., "Add your first project")
|
|
69
|
+
|
|
70
|
+
Companion rule: **hide UI that has nothing to operate on**
|
|
71
|
+
|
|
72
|
+
- Tabs with no content, filters with no items, pagination with one page — all read as broken
|
|
73
|
+
- Don't render those elements until there's content to make them useful
|
|
74
|
+
|
|
75
|
+
## Alternatives to Borders
|
|
76
|
+
|
|
77
|
+
Borders are overused. Try:
|
|
78
|
+
|
|
79
|
+
1. **Box shadow:** `box-shadow: 0 1px 3px rgba(0,0,0,0.1)` — separates without a hard line
|
|
80
|
+
2. **Two background colors:** alternating backgrounds communicate sections without lines
|
|
81
|
+
3. **More space:** sometimes the right answer is just more white space
|
|
82
|
+
|
|
83
|
+
## Beyond the Generic Pattern
|
|
84
|
+
|
|
85
|
+
Don't reach for the standard widget when something more engaging fits:
|
|
86
|
+
|
|
87
|
+
- **Enriched dropdowns:** add icons, sections, descriptions, two-column layouts inside dropdowns
|
|
88
|
+
- **Hierarchy inside table cells:** instead of equal-weight columns, give each cell its own primary/secondary tier (large dark for the main value, small grey for secondary)
|
|
89
|
+
- **Selectable cards instead of radios:** for option groups, replace radio buttons with styled card options that highlight on selection — easier to scan, more inviting
|
|
90
|
+
|
|
91
|
+
## Sharpening Design Intuition Over Time
|
|
92
|
+
|
|
93
|
+
Two practices that compound:
|
|
94
|
+
|
|
95
|
+
1. **Study the unintuitive choices in good UIs.** Find polished products you admire and ask *"why did they do that?"* — focus on choices you wouldn't have made yourself. Those are the ones worth learning from.
|
|
96
|
+
2. **Rebuild interfaces without DevTools.** Pick a UI you admire and recreate it from scratch — no inspecting the original. Forces real decisions instead of copying values.
|
|
@@ -13,6 +13,10 @@ Converts Google Stitch exports (zips with `code.html` + `screen.png`) into a nav
|
|
|
13
13
|
|
|
14
14
|
Scripts require Python 3.8+. No external dependencies (stdlib only).
|
|
15
15
|
|
|
16
|
+
## Script paths
|
|
17
|
+
|
|
18
|
+
All commands below use `<SKILL_DIR>/scripts/...` as a placeholder. Replace `<SKILL_DIR>` with the absolute "Base directory for this skill" shown in the system message when this skill loads (e.g. `~/.claude/plugins/cache/<plugin>/<version>/skills/stitch-showcase` for plugin installs, or `~/.claude/skills/stitch-showcase` for standalone installs). Do not assume `~/.claude/skills/...` — the path differs by install type.
|
|
19
|
+
|
|
16
20
|
## Workflow: Four Modes
|
|
17
21
|
|
|
18
22
|
```dot
|
|
@@ -47,7 +51,7 @@ Steps:
|
|
|
47
51
|
1. Identify the source path from the user's message
|
|
48
52
|
2. Run the build script — **nothing else**:
|
|
49
53
|
```bash
|
|
50
|
-
python
|
|
54
|
+
python <SKILL_DIR>/scripts/build_showcase.py /path/to/source
|
|
51
55
|
```
|
|
52
56
|
3. Parse the script output to get the `showcase/` path
|
|
53
57
|
4. Open the showcase in the default browser:
|
|
@@ -61,8 +65,8 @@ Steps:
|
|
|
61
65
|
Only ask `--type` or `--name` if the **script fails** or the **user explicitly wants to override**:
|
|
62
66
|
```bash
|
|
63
67
|
# Only if script fails to detect type or user requests it
|
|
64
|
-
python
|
|
65
|
-
python
|
|
68
|
+
python <SKILL_DIR>/scripts/build_showcase.py /path/to/source --type mobile
|
|
69
|
+
python <SKILL_DIR>/scripts/build_showcase.py /path/to/source --name "My App" --type mobile
|
|
66
70
|
```
|
|
67
71
|
|
|
68
72
|
## Mode 2: Enrich (on-demand — user asks)
|
|
@@ -75,7 +79,7 @@ Steps:
|
|
|
75
79
|
1. Find the source folder (from the user's message or the project's `showcase.json`)
|
|
76
80
|
2. Run `--extract-text` to get screen summaries:
|
|
77
81
|
```bash
|
|
78
|
-
python
|
|
82
|
+
python <SKILL_DIR>/scripts/build_showcase.py /path/to/source --extract-text
|
|
79
83
|
```
|
|
80
84
|
This generates `screen_summaries.txt` — a compact text file with visible text from all screen HTMLs.
|
|
81
85
|
3. Read the existing `DESIGN.md` (in the source folder) + `screen_summaries.txt`
|
|
@@ -87,7 +91,7 @@ Steps:
|
|
|
87
91
|
6. **Verify colors/fonts**: Scan the screen HTMLs for hex colors in CSS variables and font families. Update `## Colors` and `## Typography` sections if they're missing or incomplete.
|
|
88
92
|
7. Re-run the build to regenerate HTMLs with enriched data:
|
|
89
93
|
```bash
|
|
90
|
-
python
|
|
94
|
+
python <SKILL_DIR>/scripts/build_showcase.py /path/to/source
|
|
91
95
|
```
|
|
92
96
|
8. Done — tell the user the showcase has been updated with improved descriptions
|
|
93
97
|
|
|
@@ -136,13 +140,13 @@ Steps:
|
|
|
136
140
|
|
|
137
141
|
```bash
|
|
138
142
|
# Structural components (navbar, footer, sidebar, tabbar)
|
|
139
|
-
python
|
|
143
|
+
python <SKILL_DIR>/scripts/apply_canonical.py /path/to/showcase/assets/ navbar home_screen
|
|
140
144
|
|
|
141
145
|
# Atomic components (button, input, heading, etc.)
|
|
142
|
-
python
|
|
146
|
+
python <SKILL_DIR>/scripts/apply_canonical.py /path/to/showcase/assets/ button home_screen
|
|
143
147
|
|
|
144
148
|
# Target specific screens only
|
|
145
|
-
python
|
|
149
|
+
python <SKILL_DIR>/scripts/apply_canonical.py /path/to/showcase/assets/ navbar home_screen --targets login settings profile
|
|
146
150
|
```
|
|
147
151
|
|
|
148
152
|
4. Rebuild the showcase: `build_showcase.py /path/to/source`
|
|
@@ -177,13 +181,13 @@ The catalog is generated automatically as part of every build. Open `catalog.htm
|
|
|
177
181
|
|
|
178
182
|
```bash
|
|
179
183
|
# Point to the project root — the script discovers the source automatically
|
|
180
|
-
python
|
|
184
|
+
python <SKILL_DIR>/scripts/build_showcase.py /path/to/project
|
|
181
185
|
|
|
182
186
|
# Or point directly to the folder with zips/screens
|
|
183
|
-
python
|
|
187
|
+
python <SKILL_DIR>/scripts/build_showcase.py /path/to/project/stitch
|
|
184
188
|
|
|
185
189
|
# Single mega-zip (zip containing all screens as subfolders)
|
|
186
|
-
python
|
|
190
|
+
python <SKILL_DIR>/scripts/build_showcase.py /path/to/export.zip
|
|
187
191
|
```
|
|
188
192
|
|
|
189
193
|
### Flags
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
# Ch1 — Starting from Scratch
|
|
2
|
-
|
|
3
|
-
Source: "Refactoring UI" by Adam Wathan & Steve Schoger
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Feature-First Design
|
|
8
|
-
|
|
9
|
-
- Design actual features, not shells, navbars, or layouts first
|
|
10
|
-
- Pick one real feature and design it end-to-end before thinking about navigation
|
|
11
|
-
- The shell and layout emerge naturally from the features — don't force it first
|
|
12
|
-
- Resist the urge to design "the app" — design what people will actually use
|
|
13
|
-
|
|
14
|
-
## Low-Fidelity First (Thick Sharpie Trick)
|
|
15
|
-
|
|
16
|
-
- Start with low-fidelity mockups — details don't matter at this stage
|
|
17
|
-
- Use a thick Sharpie (or similar): makes it physically impossible to add fine details
|
|
18
|
-
- Sketch ideas, not pixels — get the general layout and content blocks right
|
|
19
|
-
- Avoid wireframing tools that tempt you into making polished designs too early
|
|
20
|
-
- Don't move to high-fidelity until the concept is locked
|
|
21
|
-
|
|
22
|
-
## Work in Cycles, Be a Pessimist
|
|
23
|
-
|
|
24
|
-
- Only design what you're ready to build right now
|
|
25
|
-
- Work in short design-then-build cycles, not one giant design phase
|
|
26
|
-
- Be a pessimist: cut features before building, not after
|
|
27
|
-
- A simple, complete experience beats a complex, half-built one
|
|
28
|
-
- Add features to the next version; ship the core first
|
|
29
|
-
|
|
30
|
-
## Choose a Personality
|
|
31
|
-
|
|
32
|
-
Design decisions that define personality:
|
|
33
|
-
|
|
34
|
-
**Font choice:**
|
|
35
|
-
- Serif → classic, elegant, literary (e.g., law firms, newspapers)
|
|
36
|
-
- Rounded sans-serif → playful, friendly, approachable
|
|
37
|
-
- Neutral sans-serif → plain, professional, clean
|
|
38
|
-
|
|
39
|
-
**Color:**
|
|
40
|
-
- Blue → safe, familiar, trustworthy
|
|
41
|
-
- Gold/yellow → luxurious, sophisticated
|
|
42
|
-
- Pink → fun, not-too-serious
|
|
43
|
-
|
|
44
|
-
**Border radius:**
|
|
45
|
-
- Small or none → formal, serious
|
|
46
|
-
- Large → playful, friendly
|
|
47
|
-
|
|
48
|
-
**Language register:**
|
|
49
|
-
- "An error occurred" → formal
|
|
50
|
-
- "Uh oh, something broke!" → casual and approachable
|
|
51
|
-
|
|
52
|
-
Every choice should reinforce the same personality — be consistent.
|
|
53
|
-
|
|
54
|
-
## Pre-Define Systems Before Designing
|
|
55
|
-
|
|
56
|
-
Define your system up front; make decisions once instead of every time:
|
|
57
|
-
|
|
58
|
-
- **Font sizes:** 8-10 values (type scale)
|
|
59
|
-
- **Font weights:** usually 2 (normal 400, bold 600/700)
|
|
60
|
-
- **Colors:** 8-10 shades per color, plus primary, greys, accents
|
|
61
|
-
- **Spacing:** 10-15 values on a non-linear scale
|
|
62
|
-
- **Box shadows:** 5 options (small, medium, large, extra-large, inner)
|
|
63
|
-
- **Border radius:** 3-5 options (none, small, medium, large, full)
|
|
64
|
-
- **Border widths:** 2-3 options
|
|
65
|
-
|
|
66
|
-
**Benefit:** When you need to make a decision, you're choosing from a small set, not from infinity. Eliminates decision fatigue.
|
|
67
|
-
|
|
68
|
-
## Process of Elimination
|
|
69
|
-
|
|
70
|
-
- Don't try to "find the perfect value" — start from a set and eliminate
|
|
71
|
-
- Too big? Try the next smaller option. Too close to white? Try the next shade darker.
|
|
72
|
-
- Systems make design systematic, not artistic guesswork
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
# Ch2 — Hierarchy is Everything
|
|
2
|
-
|
|
3
|
-
Source: "Refactoring UI" by Adam Wathan & Steve Schoger
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Visual Hierarchy is the #1 Design Tool
|
|
8
|
-
|
|
9
|
-
- Every element on a page is either competing for attention or supporting something else
|
|
10
|
-
- Good design is not about making everything stand out — it's about making the right things stand out
|
|
11
|
-
- If everything is emphasized, nothing is
|
|
12
|
-
|
|
13
|
-
## Use Weight and Color, Not Just Size
|
|
14
|
-
|
|
15
|
-
Three tools for hierarchy (in order of subtlety):
|
|
16
|
-
1. **Font size** — most obvious, use sparingly for big differences
|
|
17
|
-
2. **Font weight** — bold text reads as important; good for same-size emphasis
|
|
18
|
-
3. **Color** — use dark/grey/lighter-grey to create a 3-tier system:
|
|
19
|
-
- Primary: near-black for main content
|
|
20
|
-
- Secondary: mid-grey for supporting text
|
|
21
|
-
- Tertiary: lighter grey for placeholder/disabled/least important
|
|
22
|
-
|
|
23
|
-
**Never use font weights below 400** for UI text — thin/light weights look bad at small sizes on screens.
|
|
24
|
-
|
|
25
|
-
## Grey Text on Colored Backgrounds
|
|
26
|
-
|
|
27
|
-
- Don't reduce text opacity to create grey on a colored background — this desaturates and looks muddy
|
|
28
|
-
- Instead: hand-pick a color with the same hue as the background, but adjusted lightness/saturation
|
|
29
|
-
- Pick a color that feels like a "grey" version within that color family, not an actual grey
|
|
30
|
-
|
|
31
|
-
## Emphasize by De-Emphasizing Competitors
|
|
32
|
-
|
|
33
|
-
- When you want one element to stand out, try making everything around it less prominent instead of making it bigger/bolder
|
|
34
|
-
- Reduce contrast on secondary elements rather than adding more styling to primary ones
|
|
35
|
-
- This is often more effective than adding emphasis — it preserves the visual balance
|
|
36
|
-
|
|
37
|
-
## Labels: When to Skip, Combine, or Subordinate
|
|
38
|
-
|
|
39
|
-
**Skip the label when:**
|
|
40
|
-
- Format makes it obvious (e.g., an email address, a phone number, a date)
|
|
41
|
-
- Context makes it obvious (e.g., a profile page bio doesn't need "Bio:" label)
|
|
42
|
-
|
|
43
|
-
**Combine label and value:**
|
|
44
|
-
- "12 left in stock" instead of "In stock: 12"
|
|
45
|
-
- "Bedrooms: 3" → "3 bedrooms"
|
|
46
|
-
|
|
47
|
-
**Treat label as secondary:**
|
|
48
|
-
- When you do need a label, make it smaller/lighter than the value
|
|
49
|
-
- The value is what matters; the label is supporting metadata
|
|
50
|
-
|
|
51
|
-
## HTML Heading Elements ≠ Visual Size
|
|
52
|
-
|
|
53
|
-
- `<h1>`–`<h6>` are semantic, not visual
|
|
54
|
-
- An `<h1>` might visually be smaller than surrounding text if the context calls for it
|
|
55
|
-
- An `<h3>` sidebar title might be the same size as body text, just bolder
|
|
56
|
-
- Style headings based on visual hierarchy, not element level
|
|
57
|
-
|
|
58
|
-
## Icons Are Heavy — Reduce Their Contrast
|
|
59
|
-
|
|
60
|
-
- Icons carry more visual weight than text at the same size
|
|
61
|
-
- To balance icons with surrounding text, use a softer/lighter color for the icon
|
|
62
|
-
- Don't use the same high-contrast color you use for body text — icons will dominate
|
|
63
|
-
- Reduce icon contrast; increase text contrast if needed
|
|
64
|
-
|
|
65
|
-
## Increase Border Width for Low-Contrast Elements
|
|
66
|
-
|
|
67
|
-
- When a border is barely visible (low contrast), making it thicker compensates
|
|
68
|
-
- A thicker, slightly lighter border can read better than a thin, barely-there one
|
|
69
|
-
- This is especially relevant for dividers, table borders, and card edges
|
|
70
|
-
|
|
71
|
-
## Button Hierarchy
|
|
72
|
-
|
|
73
|
-
Four tiers of buttons:
|
|
74
|
-
|
|
75
|
-
| Tier | Style | Use |
|
|
76
|
-
|------|-------|-----|
|
|
77
|
-
| Primary | Solid + high-contrast fill | The main action on the page |
|
|
78
|
-
| Secondary | Outline or low-contrast fill | Supporting actions |
|
|
79
|
-
| Tertiary | Link-style (no background/border) | Least important actions |
|
|
80
|
-
| Destructive | Secondary style + confirmation step | Delete, remove, revoke |
|
|
81
|
-
|
|
82
|
-
- A page should rarely have more than one primary button
|
|
83
|
-
- Destructive actions should NOT use red as primary — make them secondary, then confirm
|
|
84
|
-
- Hierarchy between buttons prevents visual noise and guides users to the right action
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
# Ch3 — Layout and Spacing
|
|
2
|
-
|
|
3
|
-
Source: "Refactoring UI" by Adam Wathan & Steve Schoger
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Start with Too Much White Space
|
|
8
|
-
|
|
9
|
-
- Default to more white space, then remove it — don't add white space after the fact
|
|
10
|
-
- Most UIs suffer from too little spacing, not too much
|
|
11
|
-
- Dense UIs feel busy and hard to scan; generous spacing feels calm and organized
|
|
12
|
-
|
|
13
|
-
## Spacing Scale
|
|
14
|
-
|
|
15
|
-
- Use a defined, non-linear spacing scale — not arbitrary pixel values
|
|
16
|
-
- Base value: **16px** is a natural anchor point
|
|
17
|
-
- Adjacent values on the scale should differ by at least 25%
|
|
18
|
-
- Example scale (non-linear): 4, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512, 640, 768
|
|
19
|
-
- The non-linearity matters: you want clearly distinct values, not ones that look nearly the same
|
|
20
|
-
|
|
21
|
-
## Use Only the Space You Need
|
|
22
|
-
|
|
23
|
-
- Don't stretch elements to fill the full container by default
|
|
24
|
-
- Short forms don't need full-width inputs
|
|
25
|
-
- If an element's natural width is 200px, let it be 200px — don't stretch to 600px
|
|
26
|
-
- Full-width is a choice, not a default
|
|
27
|
-
|
|
28
|
-
## Shrink Your Canvas for Small Interfaces
|
|
29
|
-
|
|
30
|
-
- When designing small components (modals, cards, widgets), shrink the canvas
|
|
31
|
-
- Working at ~400px forces you to think about the actual scale
|
|
32
|
-
- Zooming out on a 1440px canvas to see a card is deceptive — elements feel more generous than they are
|
|
33
|
-
- Mobile-first approach: design at 320-400px first, then expand
|
|
34
|
-
|
|
35
|
-
## Split into Columns Instead of Stretching
|
|
36
|
-
|
|
37
|
-
- When content is too wide or elements feel stretched, introduce columns
|
|
38
|
-
- A two-column layout for a settings page beats stretching form fields across the full width
|
|
39
|
-
- Use columns to create denser, more structured layouts without sacrificing usability
|
|
40
|
-
|
|
41
|
-
## Fixed Widths for Sidebars
|
|
42
|
-
|
|
43
|
-
- Sidebars should use fixed pixel widths, not percentages
|
|
44
|
-
- A sidebar at `240px` stays consistent; at `20%` it becomes tiny or huge at different breakpoints
|
|
45
|
-
- Use `max-width` constraints for content columns rather than percentage-based grid columns
|
|
46
|
-
- Percentage widths work for responsive images and grid cells — not for UI chrome
|
|
47
|
-
|
|
48
|
-
## Responsive Scaling: Large Elements Shrink Faster
|
|
49
|
-
|
|
50
|
-
- Large headline that is 45px on desktop → should be 20-24px on mobile
|
|
51
|
-
- The ratio of reduction is not 1:1 — large elements shrink proportionally more
|
|
52
|
-
- Button padding does not scale proportionally with font size:
|
|
53
|
-
- A button with 16px font and 12px vertical padding looks right
|
|
54
|
-
- Increasing font to 24px doesn't mean padding should become 18px
|
|
55
|
-
- Often keep padding roughly the same while increasing font
|
|
56
|
-
|
|
57
|
-
## Spacing Within Groups vs. Between Groups
|
|
58
|
-
|
|
59
|
-
- More space should appear **around** a group than **within** it (Law of Proximity)
|
|
60
|
-
- Elements close together are perceived as related
|
|
61
|
-
- A form section header should have more space above it (separating from previous section) than below it (connecting to its fields)
|
|
62
|
-
- Labels should be closer to their own input than to the input above or below
|
|
63
|
-
|
|
64
|
-
## Law of Proximity Checklist
|
|
65
|
-
|
|
66
|
-
- [ ] Does the spacing clearly show which elements belong together?
|
|
67
|
-
- [ ] Is there more space between groups than within groups?
|
|
68
|
-
- [ ] Is the label closer to its own input than to adjacent inputs?
|
|
69
|
-
- [ ] Does the layout communicate grouping without relying on borders or backgrounds?
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# Ch4 — Designing Text
|
|
2
|
-
|
|
3
|
-
Source: "Refactoring UI" by Adam Wathan & Steve Schoger
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Hand-Crafted Type Scale (Avoid Modular Scales)
|
|
8
|
-
|
|
9
|
-
- Modular scales (e.g., 1.25× ratio) produce fractional pixel values and limited useful sizes
|
|
10
|
-
- Better approach: hand-pick 8-10 sizes that actually work for your use cases
|
|
11
|
-
- Example scale: 12, 14, 16, 18, 20, 24, 30, 36, 48, 60, 72px
|
|
12
|
-
- Each value should feel clearly different from adjacent ones — not nearly identical
|
|
13
|
-
|
|
14
|
-
## Use px or rem — Never em
|
|
15
|
-
|
|
16
|
-
- `em` units are relative to the parent element's font size
|
|
17
|
-
- Nesting elements with `em` compounds the sizing unpredictably
|
|
18
|
-
- Use `px` or `rem` (relative to root font size only) for type scale
|
|
19
|
-
- `em` is appropriate for things like `margin`/`padding` that should scale with font size, but NOT for defining the type scale itself
|
|
20
|
-
|
|
21
|
-
## Choosing Fonts from Google Fonts
|
|
22
|
-
|
|
23
|
-
- Filter by: "10+ styles" — this alone cuts ~85% of sans-serif fonts, leaving fewer than 50
|
|
24
|
-
- Quality signal: fonts with many weights/styles are taken seriously by their designers
|
|
25
|
-
- For UI: choose a neutral sans-serif (Helvetica-style, not geometric or humanist extremes)
|
|
26
|
-
- System font stack (`-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto`) is a safe fallback
|
|
27
|
-
- Avoid condensed fonts (narrow letterforms) or fonts with very short x-heights for body text — hard to read at small sizes
|
|
28
|
-
|
|
29
|
-
## Optimal Line Length
|
|
30
|
-
|
|
31
|
-
- Target: **45–75 characters** per line for comfortable reading
|
|
32
|
-
- Equivalent width: approximately **20–35em**
|
|
33
|
-
- Limit paragraph width even when placed inside a wider content area
|
|
34
|
-
- Too wide: eyes get lost tracking back to the next line
|
|
35
|
-
- Too narrow: too many line breaks, disrupts reading flow
|
|
36
|
-
|
|
37
|
-
## Baseline Alignment for Mixed Font Sizes
|
|
38
|
-
|
|
39
|
-
- When two elements with different font sizes sit side by side, align them by **baseline** (bottom of text), not by vertical center
|
|
40
|
-
- Vertical center alignment of mixed sizes looks off — the smaller text appears too high
|
|
41
|
-
|
|
42
|
-
## Line-Height Rules
|
|
43
|
-
|
|
44
|
-
- **Body text (narrow columns):** ~1.5 line-height
|
|
45
|
-
- **Wide columns:** up to 2.0 line-height
|
|
46
|
-
- **Large headlines:** ~1.0 or slightly below (they need almost no leading)
|
|
47
|
-
- Rule: line-height is **inversely proportional** to font size
|
|
48
|
-
- Small text → more line-height (harder to track between lines)
|
|
49
|
-
- Large text → less line-height (already easy to track; extra space feels empty)
|
|
50
|
-
|
|
51
|
-
## Styling Links
|
|
52
|
-
|
|
53
|
-
- In **link-heavy UIs** (e.g., sidebars, navigation): use heavier weight or darker color instead of blue color
|
|
54
|
-
- Color alone creates too much noise when everything is a link
|
|
55
|
-
- **Ancillary links** (e.g., "privacy policy" in footers): only show underline/color on hover
|
|
56
|
-
- Reserve high-contrast blue links for inline text where they need to stand out from surrounding prose
|
|
57
|
-
|
|
58
|
-
## Text Alignment
|
|
59
|
-
|
|
60
|
-
- **Left-align** for most text — the natural reading direction for LTR languages
|
|
61
|
-
- **Center-align** only for short text blocks (max 2–3 lines); never center long paragraphs
|
|
62
|
-
- **Right-align** numbers in tables (so decimal points and digits align vertically)
|
|
63
|
-
- **Justified text:** hyphenate it — without hyphenation, justified text creates awkward gaps
|
|
64
|
-
|
|
65
|
-
## Letter-Spacing Adjustments
|
|
66
|
-
|
|
67
|
-
- **Headlines using wide-spaced body fonts:** tighten letter-spacing slightly (negative tracking)
|
|
68
|
-
- Body fonts are optimized for reading at small sizes; at large sizes they can feel too loose
|
|
69
|
-
- **All-caps text:** always increase letter-spacing — all-caps is harder to read, extra spacing compensates
|
|
70
|
-
- Never apply tight letter-spacing to body text or all-caps — it reduces legibility
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
# Ch5 — Working with Color
|
|
2
|
-
|
|
3
|
-
Source: "Refactoring UI" by Adam Wathan & Steve Schoger
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## HSL Color Model
|
|
8
|
-
|
|
9
|
-
HSL (Hue, Saturation, Lightness) is the right model for UI color work:
|
|
10
|
-
|
|
11
|
-
- **Hue:** 0°=red, 60°=yellow, 120°=green, 180°=cyan, 240°=blue, 300°=magenta
|
|
12
|
-
- **Saturation:** 0%=grey (no color), 100%=fully vivid
|
|
13
|
-
- **Lightness:** 0%=black, 50%=pure color, 100%=white
|
|
14
|
-
|
|
15
|
-
**HSL ≠ HSB (HSV):** Different definitions of "lightness." HSB's "brightness" at 100% still gives a vivid color; HSL's lightness at 100% is always white. They are NOT interchangeable.
|
|
16
|
-
|
|
17
|
-
## What Colors You Need
|
|
18
|
-
|
|
19
|
-
A complete UI color system requires:
|
|
20
|
-
- **Greys:** 8–10 shades (used for text, backgrounds, borders, UI chrome)
|
|
21
|
-
- **Primary color:** 5–10 shades (brand color, main actions)
|
|
22
|
-
- **Accent colors:** typically 3–5 colors × 5–10 shades each
|
|
23
|
-
- Red (danger, error, destructive)
|
|
24
|
-
- Yellow (warning, caution)
|
|
25
|
-
- Green (success, positive)
|
|
26
|
-
- Others as needed (blue for info, purple, etc.)
|
|
27
|
-
|
|
28
|
-
This can mean 10 colors × 10 shades = 100 values. Define them all up front.
|
|
29
|
-
|
|
30
|
-
## Do NOT Use Preprocessor lighten()/darken()
|
|
31
|
-
|
|
32
|
-
- `lighten(blue, 20%)` just adds white or removes saturation — produces washed-out results
|
|
33
|
-
- `darken(blue, 20%)` adds black — produces muddy, lifeless results
|
|
34
|
-
- Define shades up front by hand using HSL — you'll get better results every time
|
|
35
|
-
|
|
36
|
-
## How to Build a 9-Shade Scale (100–900)
|
|
37
|
-
|
|
38
|
-
Step-by-step:
|
|
39
|
-
1. **Pick your base color** (e.g., 500): should work as a button background
|
|
40
|
-
2. **Pick the darkest shade** (e.g., 900): should work as dark text
|
|
41
|
-
3. **Pick the lightest shade** (e.g., 100): should work as a tinted background
|
|
42
|
-
4. **Fill in 700** next (halfway between 500 and 900)
|
|
43
|
-
5. **Fill in 300** next (halfway between 100 and 500)
|
|
44
|
-
6. **Fill remaining gaps** (200, 400, 600, 800) by eye
|
|
45
|
-
|
|
46
|
-
## Saturation Must Increase as Lightness Moves from 50%
|
|
47
|
-
|
|
48
|
-
- Pure HSL: as you move lightness toward 0% or 100%, the color appears less vivid
|
|
49
|
-
- To compensate, **increase saturation** as lightness increases or decreases from 50%
|
|
50
|
-
- Very light shades (lightness 90–95%): bump saturation up significantly
|
|
51
|
-
- Very dark shades (lightness 15–25%): bump saturation up to maintain richness
|
|
52
|
-
- If you don't, light shades look washed-out and dark shades look muddy
|
|
53
|
-
|
|
54
|
-
## Rotate Hue for Perceptually Better Shades
|
|
55
|
-
|
|
56
|
-
- Rotating hue slightly while lightening/darkening produces more natural results
|
|
57
|
-
- To make a **lighter** shade: rotate hue toward the nearest "bright" color (60°, 180°, 300°)
|
|
58
|
-
- To make a **darker** shade: rotate hue toward the nearest "dark" color (0°, 120°, 240°)
|
|
59
|
-
- Maximum rotation: **20–30°** — more than that and the color looks completely different
|
|
60
|
-
- This mimics how real pigments behave when tinted or shaded
|
|
61
|
-
|
|
62
|
-
## Cool vs. Warm Greys
|
|
63
|
-
|
|
64
|
-
- True neutral grey has 0% saturation — often feels clinical and bland
|
|
65
|
-
- **Cool greys:** add a small amount of blue saturation (feels modern, professional)
|
|
66
|
-
- **Warm greys:** add a small amount of yellow or orange saturation (feels inviting, human)
|
|
67
|
-
- Match grey temperature to your overall palette's temperature
|
|
68
|
-
|
|
69
|
-
## Accessible Contrast (WCAG)
|
|
70
|
-
|
|
71
|
-
- **Small text (<~18px normal weight, <~14px bold):** minimum 4.5:1 contrast ratio
|
|
72
|
-
- **Large text (≥~18px normal or ≥~14px bold):** minimum 3:1 contrast ratio
|
|
73
|
-
- Check: dark text on white bg is easier to pass than white on dark colored bg
|
|
74
|
-
|
|
75
|
-
## Accessibility Alternatives to White-on-Dark
|
|
76
|
-
|
|
77
|
-
- Instead of white text on a dark colored background, try **dark text on a light tinted background**
|
|
78
|
-
- Example: dark navy text on pale blue background — same brand color, much higher contrast
|
|
79
|
-
- This "flip" is often more accessible and looks more sophisticated
|
|
80
|
-
|
|
81
|
-
## Colored Text on Colored Background (Accessible)
|
|
82
|
-
|
|
83
|
-
- White text on a vivid colored button fails contrast if the color is too bright
|
|
84
|
-
- Instead of darkening the background, try **rotating the hue toward a bright anchor**
|
|
85
|
-
- A gold/yellow text on a dark orange button is more legible than white because yellow is inherently brighter
|
|
86
|
-
- Experiment: rotate hue toward 60° (yellow) for lighter-feeling text that still passes contrast
|
|
87
|
-
|
|
88
|
-
## Never Use Color as the Only Signal
|
|
89
|
-
|
|
90
|
-
- Color-blind users (8% of males) cannot distinguish red/green by color alone
|
|
91
|
-
- Always pair color with a second signal:
|
|
92
|
-
- Icon (checkmark, warning triangle, X)
|
|
93
|
-
- Shape difference
|
|
94
|
-
- Text label
|
|
95
|
-
- Position or contrast difference
|
|
96
|
-
- This applies to: status badges, error states, success messages, alert levels, charts
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# Ch6 — Creating Depth
|
|
2
|
-
|
|
3
|
-
Source: "Refactoring UI" by Adam Wathan & Steve Schoger
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Light Source Convention
|
|
8
|
-
|
|
9
|
-
- Light source is always **above** the interface
|
|
10
|
-
- Users look at screens from a slightly downward angle
|
|
11
|
-
- This is the physical convention all simulated depth should honor
|
|
12
|
-
|
|
13
|
-
## Raised Elements
|
|
14
|
-
|
|
15
|
-
To make an element appear raised off the page:
|
|
16
|
-
- **Lighter top edge:** use a top border or top-side inset box-shadow in a lighter color
|
|
17
|
-
- **Small dark box-shadow below:** simulates the shadow cast downward by the raised element
|
|
18
|
-
- Pick the lighter edge color by hand — do NOT use semi-transparent white (`rgba(255,255,255,0.x)`) because it desaturates the underlying color and looks fake
|
|
19
|
-
|
|
20
|
-
## Inset Elements
|
|
21
|
-
|
|
22
|
-
To make an element appear pressed into the page:
|
|
23
|
-
- **Lighter bottom edge:** use a bottom border or bottom-side inset box-shadow in a lighter color
|
|
24
|
-
- **Small dark inset shadow at top:** simulates the shadow falling into the well
|
|
25
|
-
- Same rule: hand-pick the lighter color instead of using semi-transparent white
|
|
26
|
-
|
|
27
|
-
## 5-Level Shadow Elevation System
|
|
28
|
-
|
|
29
|
-
Define 5 shadow levels (like Material Design's elevation system):
|
|
30
|
-
- **Level 1 (almost flat):** very small blur, tiny offset — element is barely raised
|
|
31
|
-
- **Level 2:** slightly larger blur and offset
|
|
32
|
-
- **Level 3:** medium blur, medium offset — default "card" shadow
|
|
33
|
-
- **Level 4:** large blur, larger offset — modals, dropdowns
|
|
34
|
-
- **Level 5 (closest to user):** very large blur, biggest offset — tooltips, popovers in foreground
|
|
35
|
-
|
|
36
|
-
Rule: small blur = slightly raised; large blur = close to the user/floating.
|
|
37
|
-
|
|
38
|
-
## Shadow Response to Interaction
|
|
39
|
-
|
|
40
|
-
- **On drag (element is "picked up"):** shadow grows — blur and offset increase as if the element moved closer to the user
|
|
41
|
-
- **On click/press (element is pressed in):** shadow shrinks and may disappear — simulates the element being pushed into the surface
|
|
42
|
-
- This gives tactile feedback without animation
|
|
43
|
-
|
|
44
|
-
## Two-Part Shadow for Realism
|
|
45
|
-
|
|
46
|
-
Real objects cast two kinds of shadow:
|
|
47
|
-
1. **Direct light shadow** (umbra): large, soft, with big offset and big blur — from the primary light source
|
|
48
|
-
2. **Ambient light shadow** (penumbra): tight, dark, with small offset and small blur — from scattered ambient light
|
|
49
|
-
|
|
50
|
-
For UI shadows:
|
|
51
|
-
- Shadow 1: large blur, large offset, low opacity (direct light)
|
|
52
|
-
- Shadow 2: small blur, small offset, higher opacity (ambient)
|
|
53
|
-
|
|
54
|
-
At higher elevations (closer to user), the ambient shadow (Shadow 2) becomes more subtle relative to Shadow 1.
|
|
55
|
-
|
|
56
|
-
## Flat Design Depth Alternatives
|
|
57
|
-
|
|
58
|
-
When shadows are not appropriate (flat aesthetic):
|
|
59
|
-
- **Lighter = closer, darker = further** — opposite of intuition with real light, but works visually
|
|
60
|
-
- Use solid, no-blur shadows: `box-shadow: 4px 4px 0 #000` for a retro/flat look
|
|
61
|
-
- These shadows define edges without implying light source
|
|
62
|
-
|
|
63
|
-
## Overlap Elements for Layering
|
|
64
|
-
|
|
65
|
-
- Overlapping one element across a background boundary creates a strong sense of layers
|
|
66
|
-
- Example: a card that straddles a dark hero and a white content area feels layered
|
|
67
|
-
- Example: an avatar that overlaps the edge of a card creates depth without shadows
|
|
68
|
-
|
|
69
|
-
## Overlapping Images: Invisible Border
|
|
70
|
-
|
|
71
|
-
- When images overlap each other or a background, edges can clash
|
|
72
|
-
- Add a border that matches the **background color** — an "invisible" border
|
|
73
|
-
- This creates separation between elements without a visible border color
|
|
74
|
-
- Also called a "halo" — a same-color buffer that prevents visual clashing
|