Terminal round 3: readable palettes, panel and card sizing, rail, tabs
- Colours: terminal background is the theme's lowest surface; the 16 ANSI colours come from a chosen palette (Theme colours, Classic, Calm, Vivid; Settings > Terminal > Colours, saved as `palette`) adjusted in lightness to the background: colours 4.5:1, bright ones lighter than normal, white light and black dark in both themes so white-on-red/blue/magenta and black-on-green/yellow/cyan (ls setuid, setgid, sticky) keep 3:1. Selection, find matches and the current match keep text at 4.5:1. - Bottom panel opens at 40% of the window, at least 16 rows, until dragged; the dragged height is remembered (old saved 300 px default reads as never resized). - Navigation rail scrolls its tabs (and below 240 px Settings too), so items never overlap under a tall panel. - Chat command cards: Expand / Collapse grows a live terminal to 60% of the window (finished output only to its rows); collapsed stays 12 rows. - Terminal tabs: ellipsised titles (220 px) with the whole title in the tooltip, selected tab filled, outlined and bold, close buttons are IconButtons (48 px touch, 40 px desktop). - Capture fixture: ?terminalColors=1 and ?terminalPalette=. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
// home shell) and terminal_open/input/resize/output/close answer as the
|
||||
// server does, with the output frames that follow. Typed text is echoed and
|
||||
// Enter prints a fresh prompt. `?terminal=panel` or `?terminal=float` opens
|
||||
// the terminal at launch in that mode.
|
||||
// the terminal at launch in that mode; `?terminalPalette=classic` (calm,
|
||||
// vivid) picks a colour palette.
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
@@ -61,6 +62,38 @@ const String _unicodeShowcase =
|
||||
'\uE0B1 \uE0B3 |\r\n'
|
||||
'icons: \uF418 \uF09B \uF303 \uE615 \u23FB |\r\n';
|
||||
|
||||
/// `?terminalColors=1`: the sixteen ANSI colours as text on the default
|
||||
/// background, as backgrounds under the default, black and white text, and
|
||||
/// the `ls` colour pairs that use them (setuid white on red, setgid black
|
||||
/// on yellow, sticky other-writable black on green, other-writable blue on
|
||||
/// green), printed into the home terminal after its prompt.
|
||||
String _colourShowcase() {
|
||||
final out = StringBuffer('printf colours\r\n');
|
||||
const names = ['blk', 'red', 'grn', 'yel', 'blu', 'mag', 'cyn', 'wht'];
|
||||
for (final base in [30, 90]) {
|
||||
for (var i = 0; i < 8; i++) {
|
||||
out.write('\x1b[${base + i}m${names[i]}${base + i}\x1b[0m ');
|
||||
}
|
||||
out.write('\r\n');
|
||||
}
|
||||
for (final fg in ['39', '30', '37', '97']) {
|
||||
for (final base in [40, 100]) {
|
||||
for (var i = 0; i < 8; i++) {
|
||||
out.write('\x1b[$fg;${base + i}m${fg.padLeft(2)}/${base + i}\x1b[0m');
|
||||
}
|
||||
out.write(' ');
|
||||
}
|
||||
out.write('\r\n');
|
||||
}
|
||||
out.write(
|
||||
'\x1b[37;41msudo\x1b[0m \x1b[30;43mwall\x1b[0m '
|
||||
'\x1b[30;42mtmp\x1b[0m \x1b[34;42mshared\x1b[0m '
|
||||
'\x1b[1;34mbold-dir\x1b[0m \x1b[1;32mrun.sh\x1b[0m '
|
||||
'\x1b[2mdim\x1b[0m \x1b[7minverse\x1b[0m\r\n',
|
||||
);
|
||||
return out.toString();
|
||||
}
|
||||
|
||||
void configureTerminalFixture(Map<String, String> params) {
|
||||
_enabled = params['terminals'] == '1';
|
||||
if (!_enabled) return;
|
||||
@@ -93,6 +126,9 @@ void configureTerminalFixture(Map<String, String> params) {
|
||||
if (params['terminalAttrs'] == '1') {
|
||||
_output['term_build'] = _output['term_build']! + _attributeShowcase;
|
||||
}
|
||||
if (params['terminalColors'] == '1') {
|
||||
_output['term_home'] = _output['term_home']! + _colourShowcase();
|
||||
}
|
||||
if (params['terminalUnicode'] == '1') {
|
||||
_output['term_build'] = _output['term_build']! + _unicodeShowcase;
|
||||
}
|
||||
@@ -101,6 +137,8 @@ void configureTerminalFixture(Map<String, String> params) {
|
||||
'float' => TerminalMode.float,
|
||||
_ => null,
|
||||
};
|
||||
final palette = TerminalPalette.values.asNameMap()[params['terminalPalette']];
|
||||
if (palette != null) TerminalLayout.instance.palette = palette;
|
||||
if (mode != null) {
|
||||
TerminalLayout.instance
|
||||
..mode = mode
|
||||
|
||||
Reference in New Issue
Block a user