@maccesar/aiskills 1.7.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 +531 -0
- package/bin/aiskills.js +76 -0
- package/lib/cache.js +49 -0
- package/lib/cleanup.js +77 -0
- package/lib/commands/auto-update.js +131 -0
- package/lib/commands/doctor.js +139 -0
- package/lib/commands/list.js +77 -0
- package/lib/commands/skills.js +263 -0
- package/lib/commands/status.js +94 -0
- package/lib/commands/uninstall.js +182 -0
- package/lib/commands/update.js +149 -0
- package/lib/config.js +90 -0
- package/lib/downloader.js +110 -0
- package/lib/hooks.js +74 -0
- package/lib/installer.js +114 -0
- package/lib/platform.js +112 -0
- package/lib/prompts/checkboxCancel.js +264 -0
- package/lib/prompts/selectCancel.js +204 -0
- package/lib/symlink.js +154 -0
- package/lib/utils.js +49 -0
- package/package.json +61 -0
- package/skills/humaniza/SKILL.md +51 -0
- package/skills/humaniza/agents/openai.yaml +4 -0
- package/skills/humaniza/references/ai-patterns-es.md +51 -0
- package/skills/humaniza/references/checklist.md +9 -0
- package/skills/humaniza/references/examples.md +17 -0
- package/skills/humaniza/references/lexicon-es-mx.md +36 -0
- package/skills/humaniza/references/modes-es-mx.md +41 -0
- package/skills/humaniza/references/voice-es-mx.md +24 -0
- package/skills/refactoring-ui/SKILL.md +59 -0
- package/skills/refactoring-ui/references/01-design-process.md +72 -0
- package/skills/refactoring-ui/references/02-visual-hierarchy.md +84 -0
- package/skills/refactoring-ui/references/03-layout-spacing.md +69 -0
- package/skills/refactoring-ui/references/04-typography.md +70 -0
- package/skills/refactoring-ui/references/05-color.md +96 -0
- package/skills/refactoring-ui/references/06-depth-shadows.md +74 -0
- package/skills/refactoring-ui/references/07-images.md +75 -0
- package/skills/refactoring-ui/references/08-finishing-touches.md +91 -0
- package/skills/stitch-showcase/SKILL.md +411 -0
- package/skills/stitch-showcase/references/01-navbar.md +52 -0
- package/skills/stitch-showcase/references/02-hero.md +56 -0
- package/skills/stitch-showcase/references/03-design-system.md +102 -0
- package/skills/stitch-showcase/references/04-screen-gallery.md +102 -0
- package/skills/stitch-showcase/references/05-viewer-web.md +105 -0
- package/skills/stitch-showcase/references/06-viewer-mobile.md +104 -0
- package/skills/stitch-showcase/references/07-theme-system.md +77 -0
- package/skills/stitch-showcase/references/08-type-detection.md +81 -0
- package/skills/stitch-showcase/references/09-quality-standards.md +126 -0
- package/skills/stitch-showcase/references/10-component-standardization.md +40 -0
- package/skills/stitch-showcase/references/11-component-catalog.md +70 -0
- package/skills/stitch-showcase/references/catalog-template.html +841 -0
- package/skills/stitch-showcase/references/index.html +299 -0
- package/skills/stitch-showcase/references/viewer.html +412 -0
- package/skills/stitch-showcase/scripts/__pycache__/build_showcase.cpython-314.pyc +0 -0
- package/skills/stitch-showcase/scripts/__pycache__/component_utils.cpython-313.pyc +0 -0
- package/skills/stitch-showcase/scripts/__pycache__/detect_components.cpython-313.pyc +0 -0
- package/skills/stitch-showcase/scripts/__pycache__/extract_catalog.cpython-313.pyc +0 -0
- package/skills/stitch-showcase/scripts/__pycache__/extract_text.cpython-313.pyc +0 -0
- package/skills/stitch-showcase/scripts/__pycache__/extract_zips.cpython-313.pyc +0 -0
- package/skills/stitch-showcase/scripts/__pycache__/parse_design_md.cpython-313.pyc +0 -0
- package/skills/stitch-showcase/scripts/apply_canonical.py +238 -0
- package/skills/stitch-showcase/scripts/build_showcase.py +2103 -0
- package/skills/stitch-showcase/scripts/component_utils.py +398 -0
- package/skills/stitch-showcase/scripts/detect_components.py +284 -0
- package/skills/stitch-showcase/scripts/extract_catalog.py +913 -0
- package/skills/stitch-showcase/scripts/extract_text.py +268 -0
- package/skills/stitch-showcase/scripts/extract_zips.py +178 -0
- package/skills/stitch-showcase/scripts/parse_design_md.py +397 -0
- package/skills/vscode-extension-dev/SKILL.md +114 -0
- package/skills/vscode-extension-dev/references/api-patterns.md +625 -0
- package/skills/vscode-extension-dev/references/architecture.md +287 -0
- package/skills/vscode-extension-dev/references/package-json-schema.md +345 -0
- package/skills/vscode-extension-dev/references/publishing.md +251 -0
|
@@ -0,0 +1,84 @@
|
|
|
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
|
|
@@ -0,0 +1,69 @@
|
|
|
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?
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
|
@@ -0,0 +1,96 @@
|
|
|
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
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Ch7 — Working with Images
|
|
2
|
+
|
|
3
|
+
Source: "Refactoring UI" by Adam Wathan & Steve Schoger
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Use Real Images From Day One
|
|
8
|
+
|
|
9
|
+
- Never design with placeholder images (grey boxes, lorem ipsum images)
|
|
10
|
+
- Placeholder images lie about how real content will look — especially for products, people, and covers
|
|
11
|
+
- Hire a photographer or use quality stock photo services (e.g., Unsplash)
|
|
12
|
+
- The visual design must work with actual images, not idealized placeholders
|
|
13
|
+
|
|
14
|
+
## Text Over Images
|
|
15
|
+
|
|
16
|
+
Option 1: **Semi-transparent overlay**
|
|
17
|
+
- Add a dark overlay (black) for light-colored text on top of a photo
|
|
18
|
+
- Add a light overlay (white) for dark-colored text on top of a photo
|
|
19
|
+
- Overlay controls how much of the image shows through
|
|
20
|
+
|
|
21
|
+
Option 2: **Lower image contrast + adjust brightness**
|
|
22
|
+
- Reduce contrast on the image itself so text has a more uniform background
|
|
23
|
+
- Brighten or darken the whole image to create a consistently light/dark canvas for text
|
|
24
|
+
|
|
25
|
+
Option 3: **Colorize the image**
|
|
26
|
+
- Desaturate the image (remove color)
|
|
27
|
+
- Apply a solid fill layer using "multiply" blend mode in your design tool
|
|
28
|
+
- Result: a single-color tone that text can sit on top of
|
|
29
|
+
|
|
30
|
+
Option 4: **Text shadow**
|
|
31
|
+
- Use a large blur, no offset text-shadow behind the text
|
|
32
|
+
- Creates a soft halo that separates text from the image background
|
|
33
|
+
- Best for small amounts of text (headlines, labels)
|
|
34
|
+
|
|
35
|
+
## Icons at Scale
|
|
36
|
+
|
|
37
|
+
- Icons designed at 16–24px look chunky and blurry when scaled to 3–4×
|
|
38
|
+
- At large sizes, use a **shaped container** with a background color instead of a raw oversized icon
|
|
39
|
+
- Put the icon inside a circle, rounded square, or other shape
|
|
40
|
+
- Scale the container to the needed size; keep the icon at its native size (or slightly larger)
|
|
41
|
+
- This prevents the "blown up icon" problem while adding visual polish
|
|
42
|
+
|
|
43
|
+
## Screenshots
|
|
44
|
+
|
|
45
|
+
Three problems with using screenshots at full scale:
|
|
46
|
+
- At 70% scale, 16px font becomes ~11px — unreadable
|
|
47
|
+
- At 50% scale, 16px font becomes 8px — completely illegible
|
|
48
|
+
|
|
49
|
+
Solutions:
|
|
50
|
+
1. **Use a tablet/narrow layout screenshot** instead of a full desktop one — content scales better
|
|
51
|
+
2. **Take a partial screenshot** — crop to just the relevant portion
|
|
52
|
+
3. **Draw a simplified version** — remove most UI, keep only what illustrates the point
|
|
53
|
+
4. Never rely on the viewer being able to read or understand text in a thumbnail screenshot
|
|
54
|
+
|
|
55
|
+
## Favicons
|
|
56
|
+
|
|
57
|
+
- A 128px logo shrunk to 16px is unrecognizable — too much detail is lost
|
|
58
|
+
- **Redraw the favicon at target size** from scratch (16×16, 32×32)
|
|
59
|
+
- Keep it to 1–2 elements; use just the icon mark, not the full wordmark
|
|
60
|
+
- Test it at 1× actual size while designing — what looks good at 128px often looks like noise at 16px
|
|
61
|
+
|
|
62
|
+
## User-Uploaded Images
|
|
63
|
+
|
|
64
|
+
Two problems: aspect ratio and background bleed.
|
|
65
|
+
|
|
66
|
+
**Aspect ratio:** User uploads won't match your layout's expected proportions.
|
|
67
|
+
- Use fixed containers (set width and height)
|
|
68
|
+
- Apply `background-size: cover` (or the equivalent `object-fit: cover`)
|
|
69
|
+
- Let the browser/engine center and crop to fill the container
|
|
70
|
+
|
|
71
|
+
**Background bleed:** Images with white or light backgrounds bleed into light-colored page backgrounds.
|
|
72
|
+
- Don't use a visible border — it creates a box outline that looks heavy
|
|
73
|
+
- Instead, add a subtle **inner box-shadow** (inset): `box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1)`
|
|
74
|
+
- This creates a soft inner ring that defines the edge without a harsh border
|
|
75
|
+
- Works across all image background colors since it sits on top of the image
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Ch8+9 — Finishing Touches & Leveling Up
|
|
2
|
+
|
|
3
|
+
Source: "Refactoring UI" by Adam Wathan & Steve Schoger
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Replace Bullets with Icons
|
|
8
|
+
|
|
9
|
+
- Default bullet points feel generic and low-effort
|
|
10
|
+
- Replace with icons that match the content:
|
|
11
|
+
- Checkmarks for feature lists or completed items
|
|
12
|
+
- Arrows for directional or sequential lists
|
|
13
|
+
- Content-specific icons (e.g., lock icon for "secure", globe for "worldwide")
|
|
14
|
+
- Icons add visual interest and reinforce meaning simultaneously
|
|
15
|
+
|
|
16
|
+
## Promote Quotation Marks as Visual Elements
|
|
17
|
+
|
|
18
|
+
- Large, decorative quotation marks can become a design element in testimonials and pull quotes
|
|
19
|
+
- Make them large, colorful (use an accent color), and position them prominently
|
|
20
|
+
- The quote mark becomes part of the visual design, not just punctuation
|
|
21
|
+
|
|
22
|
+
## Style Links Intentionally
|
|
23
|
+
|
|
24
|
+
Two approaches depending on context:
|
|
25
|
+
1. **Color + weight:** The standard blue link, but use brand color + slightly heavier font weight
|
|
26
|
+
2. **Thick colorful underline:** A thick border-bottom (2–4px) in an accent color that partially overlaps the bottom of the text
|
|
27
|
+
- Creates visual interest while remaining clearly a link
|
|
28
|
+
- Can use a different color from the text for contrast
|
|
29
|
+
|
|
30
|
+
## Custom Checkboxes and Radio Buttons
|
|
31
|
+
|
|
32
|
+
- Browser default inputs look generic and don't match brand identity
|
|
33
|
+
- Replace with custom-styled equivalents using brand color for the checked state
|
|
34
|
+
- Common pattern: custom checkbox with a checkmark SVG on a colored background
|
|
35
|
+
- Worth the extra markup for polished forms
|
|
36
|
+
|
|
37
|
+
## Accent Borders
|
|
38
|
+
|
|
39
|
+
Use a short, thick accent-color border as a decorative element:
|
|
40
|
+
- **Top of card:** a colored bar at the top edge of a card or panel
|
|
41
|
+
- **Left side of active nav item:** indicates current page/section
|
|
42
|
+
- **Left side of alert message:** differentiates alert types (red=danger, yellow=warning, green=success)
|
|
43
|
+
- **Under a headline:** a short thick underline using brand color
|
|
44
|
+
- **Top of the entire page layout:** thin color strip across the very top
|
|
45
|
+
|
|
46
|
+
These are simple, high-impact touches that add brand identity without complexity.
|
|
47
|
+
|
|
48
|
+
## Background Decoration
|
|
49
|
+
|
|
50
|
+
Options for making backgrounds interesting:
|
|
51
|
+
1. **Solid color change:** Switch from white to a brand color or neutral tint
|
|
52
|
+
2. **Gradient:** Use two hues that are no more than 30° apart on the color wheel — closer = more natural, farther = jarring
|
|
53
|
+
3. **Low-contrast repeating pattern:** Subtle geometric pattern (dots, lines, hatching) at low opacity
|
|
54
|
+
4. **Geometric shapes:** Abstract colored shapes or blobs in the background at low opacity
|
|
55
|
+
|
|
56
|
+
Key rule for gradients: keep hues within 30° of each other for a natural look.
|
|
57
|
+
|
|
58
|
+
## Empty States Are a Priority, Not an Afterthought
|
|
59
|
+
|
|
60
|
+
- Most UIs look broken or confusing when completely empty
|
|
61
|
+
- Design the empty state before adding content — it's often the first thing new users see
|
|
62
|
+
|
|
63
|
+
Good empty state components:
|
|
64
|
+
- Illustration or icon that's contextually relevant
|
|
65
|
+
- Brief, friendly explanation of what belongs here
|
|
66
|
+
- Clear call-to-action (e.g., "Add your first project" button)
|
|
67
|
+
|
|
68
|
+
Additional rule: **hide irrelevant UI until it has content**
|
|
69
|
+
- Tabs with no content, filters with no items, pagination with one page — all look broken empty
|
|
70
|
+
- Don't render those elements until there's content that makes them useful
|
|
71
|
+
|
|
72
|
+
## Alternatives to Borders
|
|
73
|
+
|
|
74
|
+
Borders are often overused. Replace them with:
|
|
75
|
+
1. **Box shadow:** `box-shadow: 0 1px 3px rgba(0,0,0,0.1)` — creates separation without a hard line
|
|
76
|
+
2. **Two different background colors:** alternating section backgrounds communicate separation without borders
|
|
77
|
+
3. **Extra spacing:** more white space between sections often eliminates the need for a border entirely
|
|
78
|
+
|
|
79
|
+
## Think Outside the Box
|
|
80
|
+
|
|
81
|
+
Don't default to generic UI patterns when something more engaging is possible:
|
|
82
|
+
|
|
83
|
+
- **Enriched dropdowns:** add icons, sections, descriptions, or two-column layouts inside dropdowns
|
|
84
|
+
- **Table column hierarchy:** instead of flat equal-weight columns, apply visual hierarchy within cells (primary value large/dark, secondary value small/grey)
|
|
85
|
+
- **Selectable cards instead of radio buttons:** replace radio button groups with styled card options that highlight on selection — more visual, easier to scan
|
|
86
|
+
|
|
87
|
+
## Leveling Up Your Eye
|
|
88
|
+
|
|
89
|
+
Two practices from the book:
|
|
90
|
+
1. **Study unintuitive decisions in good designs:** Look at polished UIs and ask "why did they do that?" Notice the specific, non-obvious choices — the things you wouldn't have thought of
|
|
91
|
+
2. **Rebuild interfaces without DevTools:** Pick a UI from a product you admire and recreate it from scratch, without inspecting the original. Forces you to make real design decisions rather than copying values
|