Skip to content

Commit 6c7c000

Browse files
committed
docs: add Tutorials button to landing page; fix foreground alpha docs; tutorials in Pages
index.html: add Tutorials big button alongside Get Started/Examples. MARKUP_SYNTAX.md: document #RRGGBBAA hex format for foreground alpha. GRADIENTS.md: correct alpha compositing description — foreground now blends against resolved background (Porter-Duff "over"), not as-is. docfx.json: include tutorials/**.md so tutorial pages build to the site. toc.yml: add Tutorials entry to the docfx navigation bar.
1 parent 900b8e9 commit 6c7c000

5 files changed

Lines changed: 28 additions & 7 deletions

File tree

docs/GRADIENTS.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,30 @@ fill.
172172

173173
### Alpha Compositing in CharacterBuffer
174174

175-
When a control writes a cell with `Color.Transparent` as the background, `CharacterBuffer`
176-
resolves the displayed background from whatever was previously written at that position —
177-
typically the gradient painted by `PreBufferPaint` before controls render.
175+
`CharacterBuffer` applies Porter-Duff "over" compositing to **both** the background and
176+
the foreground of every cell written via `SetCell` / `SetNarrowCell`.
178177

179178
```
180-
cell written with Transparent bg → display_bg = gradient color at that position
181-
cell foreground → displayed as-is over the composited background
179+
resolved_bg = Color.Blend(new_bg, existing_bg)
180+
resolved_fg = Color.Blend(new_fg, resolved_bg)
181+
```
182+
183+
**Background:** when a control writes `Color.Transparent` as the background, the existing
184+
background (typically the gradient painted before controls render) shows through unchanged.
185+
186+
**Foreground:** when a control writes a semi-transparent foreground, the glyph is blended
187+
against the *resolved background* of that cell — not against the previous foreground.
188+
This is the physically correct model: the background is what sits beneath the glyph, so a
189+
partially transparent character reveals the background behind it.
190+
191+
```
192+
new_bg = Transparent → resolved_bg = gradient color at that position
193+
new_fg = cyan @ 50 % → resolved_fg = blend(cyan, resolved_bg) // not blend(cyan, white)
182194
```
183195

184196
This means gradient window backgrounds remain visible beneath any control that uses
185-
`Color.Transparent`, even when that control has opaque foreground characters.
197+
`Color.Transparent`, and semi-transparent foreground characters (including `` full-block
198+
characters) blend smoothly into the gradient rather than fading toward white.
186199

187200
```csharp
188201
// Window with a blue→black vertical gradient

docs/MARKUP_SYNTAX.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,19 @@ SharpConsoleUI includes a native markup parser that uses Spectre-compatible `[ta
139139
```
140140
[#RRGGBB]text[/]
141141
[#RGB]text[/]
142+
[#RRGGBBAA]text[/]
142143
```
143144

144145
```csharp
145146
"[#FF8000]Orange text[/]"
146147
"[#F80]Short hex orange[/]"
147148
"[#336699]Steel blue text[/]"
149+
"[#00DCDC80]Semi-transparent cyan[/]" // 50 % opacity
150+
"[#FF000000]Fully transparent red[/]" // invisible — composites to background
148151
```
149152

153+
The 8-digit form (`#RRGGBBAA`) sets the foreground alpha. The character is composited over the resolved background color of that cell using Porter-Duff "over". At `AA=00` the glyph is invisible (background shows through); at `AA=FF` it is fully opaque. This is what powers the fade-to-transparent effect in the Alpha Blending demo — `` characters drawn with decreasing alpha dissolve smoothly into whatever gradient is underneath.
154+
150155
### RGB Colors
151156

152157
```

docs/docfx/docfx.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
{
2424
"src": "../",
25-
"files": ["*.md", "controls/**.md"],
25+
"files": ["*.md", "controls/**.md", "tutorials/**.md"],
2626
"exclude": ["**/obj/**", "**/bin/**", "docfx/**"]
2727
}
2828
],

docs/docfx/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
- name: Why SharpConsoleUI?
22
href: COMPARISON.html
3+
- name: Tutorials
4+
href: tutorials/README.html
35
- name: API Reference
46
href: api/
57
homepage: api/SharpConsoleUI.html

docs/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ <h1>SharpConsoleUI</h1>
220220

221221
<div class="quick-links">
222222
<a href="docfx/_site/BUILDERS.html" class="btn btn-primary">Get Started</a>
223+
<a href="docfx/_site/tutorials/README.html" class="btn btn-primary">Tutorials</a>
223224
<a href="docfx/_site/EXAMPLES.html" class="btn btn-primary">Examples</a>
224225
<a href="docfx/_site/COMPARISON.html" class="btn btn-primary">Why SharpConsoleUI?</a>
225226
<a href="docfx/_site/api/SharpConsoleUI.html" class="btn btn-secondary">API Reference</a>

0 commit comments

Comments
 (0)