Skip to content

Add comprehensive styling and theming guide - #1266

Closed
Kadajett wants to merge 1 commit into
mainfrom
docs/styling-and-theming
Closed

Kadajett wants to merge 1 commit into
mainfrom
docs/styling-and-theming

Conversation

@Kadajett

Copy link
Copy Markdown
Owner
  • Style system internals (Renderable SoA, packColor, setStyle)
  • Theme system (9 built-in themes, registration, switching, serialization)
  • Color system (packed RGBA, 256-color, truecolor, manipulation, WCAG contrast)
  • Style inheritance (cascading rules, cache invalidation)
  • All layout approaches (core, Layout widget, FlexContainer, constraint)
  • Borders, shadows, effects, padding
  • Common patterns and recipes
  • Performance considerations
  • Migration notes from blessed/Ink/Ratatui

- Style system internals (Renderable SoA, packColor, setStyle)
- Theme system (9 built-in themes, registration, switching, serialization)
- Color system (packed RGBA, 256-color, truecolor, manipulation, WCAG contrast)
- Style inheritance (cascading rules, cache invalidation)
- All layout approaches (core, Layout widget, FlexContainer, constraint)
- Borders, shadows, effects, padding
- Common patterns and recipes
- Performance considerations
- Migration notes from blessed/Ink/Ratatui
Copilot AI review requested due to automatic review settings February 23, 2026 03:00
@github-actions

Copy link
Copy Markdown

Performance Check Results

📁 Results file: benchmark-results.json
📏 Threshold: 20%

✅ Loaded baseline from: 2026-02-08T18:50:00.000Z

/home/runner/work/blECSd/blECSd/scripts/check-perf-regression.ts:67
		throw new Error(`Results file not found: ${resultsPath}`);
		      ^

Error: Results file not found: benchmark-results.json
    at parseResults (/home/runner/work/blECSd/blECSd/scripts/check-perf-regression.ts:67:9)
    at main (/home/runner/work/blECSd/blECSd/scripts/check-perf-regression.ts:225:25)
    at <anonymous> (/home/runner/work/blECSd/blECSd/scripts/check-perf-regression.ts:235:1)
    at ModuleJob.run (node:internal/modules/esm/module_job:343:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:665:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5)

Node.js v22.22.0

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new end-to-end guide documenting blECSd’s styling and theming model (component-level styles, color utilities, themes, stylesheets, inheritance, layout options, and common recipes) to help users understand and apply the styling system.

Changes:

  • Introduces a comprehensive “Styling and Theming” guide covering Renderable style fields, color formats, themes, stylesheets, and inheritance.
  • Documents layout approaches (core layout system, Layout widget, FlexContainer, constraint layout) and visual features (borders, padding, shadows, effects).
  • Adds performance notes and migration comparisons from other terminal UI libraries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +322 to +334
blECSd ships with 8 themes:

| Factory Function | Name | Description |
|-----------------|------|-------------|
| `createDefaultTheme()` | `'default'` | Neutral dark theme |
| `createDarkTheme()` | `'dark'` | Optimized for low-light |
| `createLightTheme()` | `'light'` | Bright backgrounds |
| `createHighContrastTheme()` | `'high-contrast'` | Maximum accessibility (pure B/W) |
| `createSolarizedTheme()` | `'solarized'` | Solarized Dark palette |
| `createMonokaiTheme()` | `'monokai'` | Monokai Pro palette |
| `createNordTheme()` | `'nord'` | Arctic color palette |
| `createDraculaTheme()` | `'dracula'` | Dark purple palette |
| `createGruvboxTheme()` | `'gruvbox'` | Retro warm palette |

Copilot AI Feb 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guide says “blECSd ships with 8 themes” but the table lists 9 (including createGruvboxTheme()), and the PR description also mentions 9 built-ins. Please update the count (or remove one entry) so the narrative matches the actual list.

Copilot uses AI. Check for mistakes.
getActiveTheme,
createDarkTheme,
applyThemeToAll,
} from 'blecsd/style';

Copilot AI Feb 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These examples import from blecsd/style, but the package currently doesn’t expose a ./style subpath export and the build config doesn’t emit dist/style (so consumers can’t import it). Either change the docs to use an actually exported entrypoint, or add src/style/index.ts to the build + package.json exports.

Suggested change
} from 'blecsd/style';
} from 'blecsd';

Copilot uses AI. Check for mistakes.
The terminal color module provides named color lookups that resolve to 256-color palette indices:

```typescript
import { nameToColor, cssNameToColor } from 'blecsd';

Copilot AI Feb 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nameToColor / cssNameToColor are exported from the terminal module (blecsd/terminal), not the Tier-1 top-level blecsd entrypoint. Update the import path in this snippet so it matches the published exports.

Suggested change
import { nameToColor, cssNameToColor } from 'blecsd';
import { nameToColor, cssNameToColor } from 'blecsd/terminal';

Copilot uses AI. Check for mistakes.
Comment on lines +589 to +596
import { computeInheritedStyle, resolveStyle } from 'blecsd';

// These are identical — resolveStyle is an alias
const style = computeInheritedStyle(world, entity);
const same = resolveStyle(world, entity);

// Check where a property comes from
import { findPropertySource } from 'blecsd';

Copilot AI Feb 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

computeInheritedStyle, resolveStyle, and findPropertySource live under the core subpath (blecsd/core), not the Tier-1 top-level blecsd entrypoint. The import path here should be updated accordingly (or the symbols need to be re-exported from blecsd if that’s the intent).

Suggested change
import { computeInheritedStyle, resolveStyle } from 'blecsd';
// These are identical — resolveStyle is an alias
const style = computeInheritedStyle(world, entity);
const same = resolveStyle(world, entity);
// Check where a property comes from
import { findPropertySource } from 'blecsd';
import { computeInheritedStyle, resolveStyle } from 'blecsd/core';
// These are identical — resolveStyle is an alias
const style = computeInheritedStyle(world, entity);
const same = resolveStyle(world, entity);
// Check where a property comes from
import { findPropertySource } from 'blecsd/core';

Copilot uses AI. Check for mistakes.
Inspired by Ratatui's layout system. Pure functions that split a rectangular area into sub-rectangles using constraints. No entities or components involved — just geometry.

```typescript
import { layoutHorizontal, layoutVertical, fixed, percentage, ratio, min, max } from 'blecsd';

Copilot AI Feb 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Constraint layout helpers (layoutHorizontal, layoutVertical, fixed, percentage, ratio, min, max) are exported from blecsd/systems. Importing them from the top-level blecsd entrypoint won’t work with the current export tiers.

Suggested change
import { layoutHorizontal, layoutVertical, fixed, percentage, ratio, min, max } from 'blecsd';
import { layoutHorizontal, layoutVertical, fixed, percentage, ratio, min, max } from 'blecsd/systems';

Copilot uses AI. Check for mistakes.
@Kadajett Kadajett closed this Feb 23, 2026
@Kadajett
Kadajett deleted the docs/styling-and-theming branch February 23, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants